From 32e16ca89a1f5cd79f767d9d0c0ebd83ff97195f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 29 Jul 2026 07:41:31 -0400 Subject: [PATCH] Bug 43192: Cast escape_str(obj) arg to string to use escapeHtml func The escape_str function in the OPAC requires the argument to be a string, and will throw a fatal error if passed a Number. This is because String.prototype.escapeHtml is created by Koha and is not a JS standard. This patch converts the object to a string before applying escapeHtml. To test, apply the patch and log in to the OPAC. - If necessary, add a list. - Search for records in the catalog and add one or more of the results to your new list. - Go to Lists -> Your lists. - In the list of your lists, click the "Delete" link for the list you added records to. - You should see a confirmation modal, "Are you sure you want to delete this list?" showing the name of the list and the number of items on it. - Clicking "Yes, delete" should delete the list. Sponsored-by: Athens County Public Libraries Signed-off-by: Roman Dolny Signed-off-by: David Cook Signed-off-by: Pedro Amorim --- koha-tmpl/opac-tmpl/bootstrap/js/global.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/global.js b/koha-tmpl/opac-tmpl/bootstrap/js/global.js index 2e9d20287f..130d17b3a7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/global.js @@ -50,7 +50,7 @@ String.prototype.escapeHtml = function () { }); }; function escape_str(s) { - return s != null ? s.escapeHtml() : ""; + return s != null ? s.toString().escapeHtml() : ""; } function confirmDelete(message) {