django-json-widget icon indicating copy to clipboard operation
django-json-widget copied to clipboard

</script> is a problem

Open johanneswilm opened this issue 1 year ago • 0 comments

  • django-json-widget version: 1.1.1
  • Django version: 4.2.3
  • Python version: 3.11
  • Operating System: N/A

Description

I tried to show a json widget. But it was broken. Then I discovered that it was one of the fields inside my json that had the content </script>. Something like:

{"html": "<p>A paragraph</p><script>const a = 10;</script>"}

The issue is this: The </script> makes the script used by django-json-widget end immediately there. So the reminder of the json is rendered into the browser and the json widget throws an error in the JavaScript developer console.

johanneswilm avatar Nov 21 '23 23:11 johanneswilm