From 982a6edc267749710e106736fef95b5ae4f1b4f3 Mon Sep 17 00:00:00 2001 From: James Murdza Date: Fri, 6 Sep 2024 15:27:02 -0700 Subject: [PATCH] fix: encode line breaks when making requests to the AI generation worker --- backend/server/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/server/src/index.ts b/backend/server/src/index.ts index 18078e7..d4bb713 100644 --- a/backend/server/src/index.ts +++ b/backend/server/src/index.ts @@ -618,7 +618,7 @@ io.on("connection", async (socket) => { // Generate code from cloudflare workers AI const generateCodePromise = fetch( - `${process.env.AI_WORKER_URL}/api?fileName=${fileName}&code=${code}&line=${line}&instructions=${instructions}`, + `${process.env.AI_WORKER_URL}/api?fileName=${encodeURIComponent(fileName)}&code=${encodeURIComponent(code)}&line=${encodeURIComponent(line)}&instructions=${encodeURIComponent(instructions)}`, { headers: { "Content-Type": "application/json",