Closed Bug 1334713 Opened 7 years ago Closed 5 years ago

Special characters are being incorrectly escaped

Categories

(Developer Documentation Graveyard :: Macros/Templates, defect, P5)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: arous0, Unassigned)

References

()

Details

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

This template escapes special xml chars (<>&), as you can see here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators#Bitwise_shift_operators

I tried editing the template, it won't let me, tried creating another to experiment, same issue
Component: General → Macros/Templates
OS: Other → All
https://github.com/mozilla/kumascript/blob/12839b2f36bfd9ae10215e65ac6a81c08aef5658/macros/jsxref.ejs#L54
> var str = $1 || $0;
> ...
> %><a href="<%- URL + $2 %>" title="<%-summary%>"><%- code %><%= str %><%- endcode %></a>

for example, & operator, |str| contains "&amp;", and it's escaped again by |<%= str %>|, so it becomes "&amp;amp;" and shown as "&amp;" instead of "&".
if |str| is always escaped, we could use <%- str %> instead
(haven't checked if it's really always escaped tho)


(In reply to tGDA from comment #0)
> I tried editing the template, it won't let me, tried creating another to
> experiment, same issue

macro is moved to https://github.com/mozilla/kumascript/tree/master/macros
I checked again and the problem is not with the template itself, but with the page. Apparently it was edited in WYSIWYG that escaped the characters.

I edited it in source mode (no WYSIWYG) and fixed the issue:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators#Bitwise_shift_operators
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
no, the source gets escaped on server side while publishing.

looks like there's some difference between preview and published page,
since even preview page shows correctly for unescaped source, published page shows them as escaped.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
Hmmm... The problem still persists! Although it showed correctly on preview page, when saved nothing changed, even history log says so:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators$compare?locale=en-US&to=1178909&from=1138607
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators$compare?locale=en-US&to=1179827&from=1178909

I am removing resolved flag.
See Also: → 1334887

The HTML source gets escaped by CKEditor, which is correct. As part of bug 1335006, the macro was updated to correctly handle when an escaped string like "<" is used as the name. See https://bugzilla.mozilla.org/show_bug.cgi?id=1334887#c2 for details.

Status: REOPENED → RESOLVED
Closed: 7 years ago5 years ago
Depends on: 1335006
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.