Fix the HTML encoding when uploading a folder in FF when using french…#460
Conversation
|
That was a quick fix. Thank you, it works perfectly. |
| fileName: escapeHTML(data.files[0].name), | ||
| message: data.errorThrown | ||
| }); | ||
| }, undefined, {escape: false}); |
There was a problem hiding this comment.
I got to say that I consider this a kinda risky chance. While data.errorThrown may right now not echo back user controlled input this has still the potential to do bad things in the future… 🙈
There was a problem hiding this comment.
Can we do that at
server/apps/files/js/file-upload.js
Lines 357 to 360 in 45c99c2
There was a problem hiding this comment.
The file name is already escaped there, it is also escaped here.
The problem is, that the actual translation contains the ', and when using that string here as a parameter in the translation, it is html encoded and displayes as &#...;. So not sure how this could be fixed on the other place, if this place breaks it.
There was a problem hiding this comment.
Simply unescape
server/apps/files/js/file-upload.js
Lines 357 to 360 in 45c99c2
There was a problem hiding this comment.
Aha… Gotcha now… Let me think…
There was a problem hiding this comment.
unescape what? the unescape option only affects parameters, but the parameter is not the problem. Also the value in data.errorThrown here is not a problem, it's still what we would display in the UI. It's the t() method here, which takes the translated string as an argument and thereby s/'/&#..; the first translation. TO avoid this I removed escaping from all parameters and only escaped the file name, since the string here is only translator controlled, not user controlled, we can and have to trust it anyway....
There was a problem hiding this comment.
Ok. You're right. This is also properly escaped all since we don't use showHTML. (so even when passing HTML strings this shouldn't be rendered as HTML anyways)
|
👍 |
|
@nickvergessen @LukasReschke Backport? |
… l10n
Fix #459
Please review @tflidd