Summary: | Text needs HTML filter before KohaSpan filter | ||
---|---|---|---|
Product: | Koha | Reporter: | Fridolin Somers <fridolin.somers> |
Component: | Templates | Assignee: | Fridolin Somers <fridolin.somers> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | andrewfh, kyle, solene.desvaux, victor |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29589 | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
22.05.00,21.11.03,21.05.13
|
|
Attachments: |
Bug 29853: Add HTML filter before KohaSpan filter
Bug 29853: Add HTML filter before KohaSpan filter Bug 29853: Add HTML filter before KohaSpan filter |
Description
Fridolin Somers
2022-01-11 22:48:55 UTC
> git grep '$KohaSpan' -- koha-tmpl/ koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt: [% added.library.branchname | $KohaSpan class = 'name' | $raw %] added to group. koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt: Group [% added.title | $KohaSpan class = 'name' | $raw %] created. koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt: Group [% deleted.title | $KohaSpan class = 'name' | $raw %] has been deleted. koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt: [% deleted.library | $KohaSpan class = 'name' | $raw %] has been removed from group. koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt: A group with the title [% error_duplicate_title | $KohaSpan class = 'name' | $raw %] already exists. We can reproduce in library groups page : Create a new library group with title : Mygrou</div>pe Save the form. You see a message box with : Group Mygrou Created attachment 129325 [details] [review] Bug 29853: Add HTML filter before KohaSpan filter Usage of Template Toolkit plugin KohaSpan as filter is actually : Group [% added.title | $KohaSpan class = 'name' | $raw %] created. But KohaSpan filter does not escape HTML characters. Whe should filter HTML then KohaSpan. This patch adds TT html filter before KohaSpan. Also replaces in Javascript html() with text() to ensure special caracters are still encoded. See https://api.jquery.com/text/ Test plan : 1) Create a library with name Libra'rie 2) Create a library group with name Grou'pe 3) Play with this group 4) Add library 5) Remove library 6) Edit group 7) Delete group 8) Each time check that &apos, is not interpreted as single quote Maybe we should have a coding guide line for this. Is see it is quite different for SMTP servers : $("#delete_confirm_dialog").html( _("You are about to delete the '%s' SMTP server.").format(smtp_server_name) ); https://git.koha-community.org/Koha-community/Koha/src/commit/a6ef152db9e71805efe8e7dd6b2f8549da0f65b4/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt#L392 Looks better for translation. Created attachment 130547 [details] [review] Bug 29853: Add HTML filter before KohaSpan filter Usage of Template Toolkit plugin KohaSpan as filter is actually : Group [% added.title | $KohaSpan class = 'name' | $raw %] created. But KohaSpan filter does not escape HTML characters. Whe should filter HTML then KohaSpan. This patch adds TT html filter before KohaSpan. Also replaces in Javascript html() with text() to ensure special caracters are still encoded. See https://api.jquery.com/text/ Test plan : 1) Create a library with name Libra'rie 2) Create a library group with name Grou'pe 3) Play with this group 4) Add library 5) Remove library 6) Edit group 7) Delete group 8) Each time check that &apos, is not interpreted as single quote Signed-off-by: Solène Desvaux <solene.desvaux@biblibre.com> I have executed the test plan, it is working for me Created attachment 130813 [details] [review] Bug 29853: Add HTML filter before KohaSpan filter Usage of Template Toolkit plugin KohaSpan as filter is actually : Group [% added.title | $KohaSpan class = 'name' | $raw %] created. But KohaSpan filter does not escape HTML characters. Whe should filter HTML then KohaSpan. This patch adds TT html filter before KohaSpan. Also replaces in Javascript html() with text() to ensure special caracters are still encoded. See https://api.jquery.com/text/ Test plan : 1) Create a library with name Libra'rie 2) Create a library group with name Grou'pe 3) Play with this group 4) Add library 5) Remove library 6) Edit group 7) Delete group 8) Each time check that &apos, is not interpreted as single quote Signed-off-by: Solène Desvaux <solene.desvaux@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Pushed to master for 22.05, thanks to everybody involved 🦄 Pushed to 21.11.x for 21.11.03 Pushed to 21.05.x for 21.05.12 Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed. |