From f5bb8907d4533d012545c38623b3a1c79fabdfa3 Mon Sep 17 00:00:00 2001 From: Tom Cannaerts Date: Fri, 22 Nov 2024 10:38:22 +0100 Subject: [PATCH] SANTA-231 don't add if already present --- src/Service/UrlTransformerService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Service/UrlTransformerService.php b/src/Service/UrlTransformerService.php index 245b54ad..2f27da2d 100644 --- a/src/Service/UrlTransformerService.php +++ b/src/Service/UrlTransformerService.php @@ -121,7 +121,10 @@ public function transformUrl(string $url): string case 'amazon_' == substr($key, 0, 7): // append id as tag parameter if (isset($urlParts['query'])) { - $url .= '&tag='.$partnerId; + // don't touch if there's already a tag present + if (false === strpos($urlParts['query'], '&tag=') && 'tag=' !== substr($urlParts['query'], 0, 4)) { + $url .= '&tag='.$partnerId; + } } else { $url .= '?tag='.$partnerId; }