From 8921cd83bb8d385b15c0e27a09a722972bbdf039 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 548d23e..c78272b 100644 --- a/backend/server/src/index.ts +++ b/backend/server/src/index.ts @@ -612,7 +612,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",