Skip to content

Commit b5b9f8b

Browse files
committed
Encode prompt when sending to the sw (#346)
1 parent 29e6eaf commit b5b9f8b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/workers/python-worker.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ const reactPyModule = {
3232
getInput: (id: string, prompt: string) => {
3333
const request = new XMLHttpRequest()
3434
// Synchronous request to be intercepted by service worker
35-
request.open('GET', `/react-py-get-input/?id=${id}&prompt=${prompt}`, false)
35+
request.open(
36+
'GET',
37+
`/react-py-get-input/?id=${id}&prompt=${encodeURIComponent(prompt)}`,
38+
false
39+
)
3640
request.send(null)
3741
return request.responseText
3842
}

0 commit comments

Comments
 (0)