Bug 27694 - News tool editor (codemirror) automatically converts HTML entities
Summary: News tool editor (codemirror) automatically converts HTML entities
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial
Assignee: Lucas Gass (lukeg)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-12 15:55 UTC by Lucas Gass (lukeg)
Modified: 2022-06-06 20:25 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00
Circulation function:


Attachments
Bug 27694: use HTML filtering on News Tool textarea (1.42 KB, patch)
2021-02-12 16:01 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 27694: use HTML filtering on News Tool textarea (1.47 KB, patch)
2021-02-16 14:49 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 27694: use HTML filtering on News Tool textarea (1.53 KB, patch)
2021-02-17 20:19 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2021-02-12 15:55:54 UTC
When using CodeMirror in the Koha News tool the editor automatically converts HTML entities which can be problematic.  


For example:

<option value="(itype:DVD and loc:*NEW) AND NOT index-term-genre:&quot;television&quot;">Movies</option>

Gets converted to:

<option value="(itype:DVD and loc:*NEW) AND NOT index-term-genre:"television"">Movies</option>
Comment 1 Lucas Gass (lukeg) 2021-02-12 16:01:48 UTC
Created attachment 116839 [details] [review]
Bug 27694: use HTML filtering on News Tool textarea

To test:
1. Add some HTML enties to your codemirror in the News Tool. Example: <option value="(itype:DVD and loc:*NEW) AND NOT index-term-genre:&quot;television&quot;">Movies</option>
2. Save and re-eneter the tool, the HTML entites have been converted
3. Apply patch
4. Try again, HTML entities should not be converted
Comment 2 ByWater Sandboxes 2021-02-16 14:49:49 UTC
Created attachment 116926 [details] [review]
Bug 27694: use HTML filtering on News Tool textarea

To test:
1. Add some HTML enties to your codemirror in the News Tool. Example: <option value="(itype:DVD and loc:*NEW) AND NOT index-term-genre:&quot;television&quot;">Movies</option>
2. Save and re-eneter the tool, the HTML entites have been converted
3. Apply patch
4. Try again, HTML entities should not be converted

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.org>
Comment 3 Katrin Fischer 2021-02-17 20:15:37 UTC
This appears to work, but is it expected that you can't use the source view of the visual editor to enter <option value="(itype:DVD and loc:*NEW) AND NOT index-term-genre:&quot;television&quot;">Movies</option> ? It only leaves "Movies" and that's scary. 

Does it mean opening in the wrong editor and saving, you'll completely destroy things?
Comment 4 Katrin Fischer 2021-02-17 20:18:12 UTC
(In reply to Katrin Fischer from comment #3)
> This appears to work, but is it expected that you can't use the source view
> of the visual editor to enter <option value="(itype:DVD and loc:*NEW) AND
> NOT index-term-genre:&quot;television&quot;">Movies</option> ? It only
> leaves "Movies" and that's scary. 
> 
> Does it mean opening in the wrong editor and saving, you'll completely
> destroy things?

Ok. it only destroy entries if it doesn't like your HTML. Adding the surrounding select make it stay ok.
Comment 5 Katrin Fischer 2021-02-17 20:19:52 UTC
Created attachment 116966 [details] [review]
Bug 27694: use HTML filtering on News Tool textarea

To test:
1. Add some HTML enties to your codemirror in the News Tool. Example: <option value="(itype:DVD and loc:*NEW) AND NOT index-term-genre:&quot;television&quot;">Movies</option>
2. Save and re-eneter the tool, the HTML entites have been converted
3. Apply patch
4. Try again, HTML entities should not be converted

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Jonathan Druart 2021-02-18 11:05:59 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 7 Fridolin Somers 2021-02-22 10:21:50 UTC
when using "Edit with text editor", html is escaped twice :
&quot; > &amp;quot;

Is this the expected behavior ?