Fixes some more wrong escaping methods being used in frontend files. #288
+7
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The last 2 versions released introduced improved escaping, but it looks like some wrong methods got used.
Especially in the javascript area, you should use
escapeJsinstead ofescapeHtml(see below for example).Also, to output an url in javascript, the documentation recommends to still use
escapeJsinstead ofescapeUrl:Also the url for the
<noscript>tag was generated in a strange way by escaping parts of the url in 2 different ways, this has been simplified which makes the code more readable and more correct.Watch out, I've only tested the changes in
iframe.phtmlandscript.phtmlmyself, maybe double check the other changes as well yourself.//cc @jissereitsma
Locally, I created a small proof of this in the
script.phtmlby changing the php variable$gtmIdto"test'ing"as a way to demonstrate the problem.With the old
escapeHtmlmethod, this would output:'test'ing', which Javascript interprets as:test'ingWith the new
escapeJsmethod, this will output:'test\u0027ing', which Javascript interprets astest'ingwhich is what we want.