Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix post contentHtml sometimes breaking script parsing
<\/script> tags in post content would sometimes be recognized as actually ending the script tag, even when escaped (not exactly sure why). This is fixed by encoding the < > characters in unicode.
- Loading branch information
ea4d889
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, this is not quite enough. See this Laravel PR.
Once we upgrade to Laravel 5.5, we can use the
@json
directive that should - by then - be safe, I hope. :)ea4d889
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure the extra options are necessary though? HTML parsers ignore everything within
<script>
tags except for</script>
, so I would think just encoding<
and>
is sufficient.ea4d889
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I suppose encoding the other characters would be necessary if outputting JSON outside the context of a
<script>
tag (eg. an attribute value). Good job :)