From 6f2d4a32feb8fd179c53177dd77adb331e41fd27 Mon Sep 17 00:00:00 2001 From: Paul Derscheid Date: Fri, 6 Mar 2026 17:59:01 +0100 Subject: [PATCH] Bug 41580: (QA follow-up) Fix msg type coercion in upload alerts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The tidy wrapped the msg variable in quotes, coercing a JS object literal to a string which breaks ShowAlerts iteration over file properties - The original also used | html which would HTML-escape the JSON quotes, a pre-existing bug - Use | $raw with a TT IF guard, matching the codebase convention for passing JSON from Perl to JS (e.g. TablesSettings) To test: - Go to Administration → Authorized values → UPLOAD and create a category - Go to Tools → Upload, select the category, upload a file - Search uploads by category to find the uploaded file - Delete the file - Verify the alert shows ": File has been deleted." - Without the fix, the page shows "0: undefined, 1: undefined, ..." because ShowAlerts iterates over character indices of a string instead of properties of a JSON object Signed-off-by: Paul Derscheid --- koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt index 2f12b0d95e4..13e29114ec7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt @@ -373,7 +373,7 @@ addPrefs({ OPACBaseURL: "[% Koha.Preference('OPACBaseURL') | html %]", }); - const msg_alert = "[% msg | html %]"; + const msg_alert = [% IF msg %][% msg | $raw %][% ELSE %]null[% END %];