fix: encode line breaks when making requests to the AI generation worker

This commit is contained in:
James Murdza 2024-09-06 15:27:02 -07:00
parent 45097e0f20
commit 8921cd83bb

View File

@ -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",