From bugzilla-daemon@bugs.koha-community.org Tue Aug 6 12:32:16 2024 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 37573] New: Bad escaping in OPACSearchForTitleIn breaks JS in ``` you will actually end up with: ``` ``` It seems that whatever parses the template arguments within {...} does so without consideration about possible other use of these brackets. What should actually happen, is that what's inside of brackets should only be replaced if it's a valid param such as {AUTHOR} etc, otherwise the argument should probab= ly be ignored (or at the very least keep current behavior only if it passes some regex like \{[A-Z_]+\}... It actually looks like the removal was explicit: https://github.com/Koha-Community/Koha/blob/8ff9e665e4d275ac601ee5165ab4233a1= 4189f2c/C4/Output.pm#L411 Meaning that to keep this behavior, it'd be best to adjust the regex to be mo= re conservative. Either that, or just junk that line altogether... --=20 You are receiving this mail because: You are watching all bug changes. --===============8006349464105836308==-- From bugzilla-daemon@bugs.koha-community.org Tue Aug 6 12:35:04 2024 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 37573] Bad escaping in OPACSearchForTitleIn breaks JS in tags either... --=20 You are receiving this mail because: You are watching all bug changes. --===============6461148069973123118==-- From bugzilla-daemon@bugs.koha-community.org Mon Aug 19 04:20:10 2024 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 37573] Bad escaping in OPACSearchForTitleIn breaks JS in tags either... I should share my use case. I have a tag like this: Other L= ibraries (WorldCat) And at the bottom (it doesn't set up the event listener right away, as we have two searches like this, so to avoid double API calls): The JS func that's called accesses the MARC with the public API and extracts info such as direct WorldCat id if it exists, and then swaps the generic title search URL to a direct link to the record. I realize now that is kinda weird and technically I could've just used "id" attribute in HTML, since it won't be duplicated in the DOM due to nature of Koha and XHR loading not being used in this particular place. But... > I reckon Owen's idea at bug 36805 is a good way to go. I kind of have another issue with this. Replacing this to be a very simple li= st of URLs would limit people to just the currently provided minimal templates, = or they'd have to resort to using awkward CSS selectors in the JS. I guess it could work if one used TT templates only... To keep it being featureful, one should have access to any fields from MARC and conditional variables there. For example, with the search above in WorldCat, we want to change what kind of URL is shown based on whether custom field in MARC with t= he ID exists (we keep it somewhere in 9xx unfortunately, not in the standard field...). And in the second case, we want to see if a field exists in MARC a= nd only then show the particular search URL. So the only ways to achieve it all would be either with JS, or with TT templates with full access to the MARC da= ta of the record so that it wouldn't have to be fetched from REST API... --=20 You are receiving this mail because: You are watching all bug changes. --===============2293113707035018240==-- From bugzilla-daemon@bugs.koha-community.org Mon Aug 19 13:06:19 2024 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 37573] Bad escaping in OPACSearchForTitleIn breaks JS in 2. Go to OPAC and open some biblio record's page. 3. Open dev tools console (Ctrl+Shift+I). Before applying the patch you should see a syntax error, after applying it you should see "test!" logged. > This fix also seems like a bit of a hack still, as it means your link text = couldn't be "Awesome {Library}". Single braces really aren't great for templa= te tokens, but too late to change that now. I think that's just a matter of adjusting the regex. Allowing lower-case chars would be relatively reasonable if need be. Allowing a bunch of text that's a body of JS code block, constituting of other characters like semicolons and newlines: probably not. --=20 You are receiving this mail because: You are watching all bug changes. --===============6691443234047100401==-- From bugzilla-daemon@bugs.koha-community.org Tue Aug 20 03:34:55 2024 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 37573] Bad escaping in OPACSearchForTitleIn breaks JS in 2. Go to OPAC and open some biblio record's page. 3. Open dev tools console (Ctrl+Shift+I). Before applying the patch you should see a syntax error, after applying it you should see "test!" logged. Signed-off-by: Magnus Enger Works as advertised. I added the test plan from Bugzilla to the commit message above. -- You are receiving this mail because: You are watching all bug changes. --===============6365016262112056778==-- From bugzilla-daemon@bugs.koha-community.org Fri Nov 1 01:31:11 2024 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 37573] Bad escaping in OPACSearchForTitleIn breaks JS in