From 1294d559aedb3acfa266ab6203a0046f0caab479 Mon Sep 17 00:00:00 2001 From: Jake Deery Date: Tue, 3 Mar 2026 13:31:07 +0000 Subject: [PATCH] Bug 41976: LinkWrapper no longer mangles links This patch fixes a bug where, context-dependent, LinkWrapper can keep referencing back to links that should be out of scope. This was causing odd behaviour whilst writing Bug 14962 - namely, links returning as the same value in a table of multiple rows due to LinkWrapper treating linkData.href as one and the same for each row. TO TEST: == APPLY PATCH == a) enable ERMModule syspref, go to /cgi-bin/koha/erm/erm.pl b) notice all links and buttons still work as expected c) go to /cgi-bin/koha/sip2/sip2.pl d) notice all links and buttons still work as expected e) go to /cgi-bin/koha/acquisition/vendors f) notice all links and buttons still work as expected g) enable PreservationModule syspref, go to /cgi-bin/koha/preservation/home.pl h) notice all links and buttons still work as expected == SIGN OFF == Signed-off-by: David Nind --- .../prog/js/vue/components/LinkWrapper.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/LinkWrapper.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/LinkWrapper.vue index 30e0adeb52..df207c4140 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/LinkWrapper.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/LinkWrapper.vue @@ -10,7 +10,7 @@ @@ -26,6 +26,7 @@ export default { resource: Object, }, setup(props) { + const formattedHref = ref(props.linkData?.href); const formattedParams = ref({}); if (props.linkData && props.linkData.params) { @@ -36,16 +37,17 @@ export default { } if (props.linkData?.href && props.linkData.params) { - props.linkData.href += "?"; + formattedHref.value += "?"; Object.keys(props.linkData.params).forEach(key => { - props.linkData.href += `${key}=${formattedParams.value[key]}&`; + formattedHref.value += `${key}=${formattedParams.value[key]}&`; }); - props.linkData.href = props.linkData.href.slice(0, -1); + formattedHref.value = formattedHref.value.slice(0, -1); } if (props.linkData?.href && props.linkData.slug) { - props.linkData.href += `/${props.resource[props.linkData.slug]}`; + formattedHref.value += `/${props.resource[props.linkData.slug]}`; } return { + formattedHref, formattedParams, }; }, -- 2.39.5