From 9ddae25e63b23d1747b97c9ccf3f79822141e190 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 4 Aug 2026 17:10:19 +0100 Subject: [PATCH] Bug 42800: (QA follow-up) Fix backslash breaking the shelf list script block erm.tt built the logged_in_user_lists JS array by manually interpolating each shelf's id/name into a JS string literal, escaped with the TT html filter: id: "[% shelf.shelfnumber | html %]", name: "[% shelf.shelfname | html %]", The html filter escapes <, >, &, and " -- enough to stop the -breakout scenario from the original bug -- but it does not escape backslashes. A list name ending in a backslash (e.g. "foo\") escapes the closing quote of the JS string literal, unbalancing it and throwing a JS syntax error that breaks the whole inline and confirm it displays as inert text, not executing, on the same pages. (cherry picked from commit afa208e950efae6c3a6e27c74af6d9184602b737) Signed-off-by: Fridolin Somers --- koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt index f73caad780..c055010bb0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt @@ -42,15 +42,11 @@ const max_allowed_packet = [% To.json(max_allowed_packet) | $raw %]; - let logged_in_user_lists = []; + [% SET logged_in_user_lists_data = [] %] [% FOR shelf IN logged_in_user.virtualshelves %] - logged_in_user_lists.push( - { - id: "[% shelf.shelfnumber | html %]", - name: "[% shelf.shelfname | html %]", - } - ); + [% logged_in_user_lists_data.push( { id => shelf.shelfnumber.html, name => shelf.shelfname.html } ) %] [% END %] + const logged_in_user_lists = [% To.json(logged_in_user_lists_data) | $raw %]; const logged_in_user = [% To.json(logged_in_user.unblessed) | $raw %];