From 787343b8d954bc999cbe71308706390cfd2dcf3f 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. Signed-off-by: Wainui Witika-Park --- 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 433cff377a..74d638cc5b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt @@ -41,15 +41,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 %];