dodona-edu / judge-turtle

🐢 Python Turtle judge for the Dodona learning environment
GNU Affero General Public License v3.0
0 stars 1 forks source link

Images are not shown in output #66

Open niknetniko opened 1 year ago

niknetniko commented 1 year ago

When submitting solutions for the Turtle judge, I can't seem to get the images to work:

image

Tested in both Firefox and Chrome.

(Not entirely sure if this is a turtle judge issue or a Dodona issue, but I'll move the issue to the correct repo if necessary)

BTWS2 commented 1 year ago

Thank you for notifying me. Images form submissions that worked correctly in the past are also gone (e.g. https://dodona.ugent.be/nl/submissions/11622640/), but the code from the judge didn't change. This leads me to believe this is a Dodona issue.

jorg-vr commented 11 months ago

Summary of slack discussion:

data:image/svg+xml is no longer supported due to security concerns (see https://github.com/rails/rails-html-sanitizer/pull/147)

I suggest to render svg's inline instead of as an image. This allows for proper sanitizing by rails.

jorg-vr commented 11 months ago

In the code png versions of the images are calculated but never used, so using this might be an option as well if simply inlining the svg does not work. (But inlining the svg still seems prefered as it would also lower complexity of the judge) https://github.com/dodona-edu/judge-turtle/blob/3f3ba3d70f95d42646a4c891bdd8b273a4812169/turtle_judge.py#L71-L94