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 300de1f03a
commit 982a6edc26

View File

@ -618,7 +618,7 @@ io.on("connection", async (socket) => {
// Generate code from cloudflare workers AI // Generate code from cloudflare workers AI
const generateCodePromise = fetch( 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: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",