-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix escaping of <py-script> #1764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
this was already fixed and it still works out of this smoke test https://github.com/pyscript/pyscript/blob/main/pyscript.core/test/html-decode.html but I went ahead and noticed that we have issues only if there are repeated shenanigans: <py-script>
# works
import js
# js.console.log("E", 1<2, 1>2)
js.console.log("F <div></div>")
</py-script>
<py-script>
# works
import js
js.console.log("E", 1<2, 1>2)
</py-script>
<py-script>
# fail
import js
js.console.log("E", 1<2, 1>2)
# js.console.log("F <div></div>")
</py-script> So yes, this is a bug but it's a weird one. |
P.S. just to provide some background:
not that was not it, both We need to do that right before reverting current code, imho. |
Uh oh!
There was an error while loading. Please reload this page.
This is a sub issue of #1762 and it's related to the following test:
pyscript/pyscript.core/tests/integration/test_01_basic.py
Lines 162 to 184 in c6aaacd
Something is very weird when it comes to
<py-script>
parsing. If you try to run this code:With PyScript classic, you get the following output, as expected:
With 2023.09.1RC1, something very weird happens: the "C" and "D" line are parsed correctly, but the "E" line causes troubles:

You can see it in action here (and you can also see that by using 2023.05.1 it works):
https://pyscript.com/@antocuni/py-script-escaping/latest
I know that
<py-script>
parsing is fragile and bad things can happen, but if pyscript classic was able to deal with it correctly, then pyscript next should do the same.For reference, this is the code which was responsible to decode the content inside
<py-script>
tags in classic:pyscript/pyscriptjs/src/utils.ts
Lines 9 to 12 in 52bd64c
8000 The text was updated successfully, but these errors were encountered: