From faee63cc3a8c4d55ea26705ac52dacefb7361a02 Mon Sep 17 00:00:00 2001 From: Ansgar Hofmann Date: Thu, 21 Mar 2024 10:24:11 +0100 Subject: [PATCH] Don't add "?" to URL if $queryParameters is empty When building a URL, with `NO_ADD_SID`, it could happen that there are no other query parameters. In this case, we can leave `$url` as it is. --- src/UrlGeneratorService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/UrlGeneratorService.php b/src/UrlGeneratorService.php index ec66ca5..3046753 100644 --- a/src/UrlGeneratorService.php +++ b/src/UrlGeneratorService.php @@ -26,7 +26,9 @@ private function addSid(string $url, ?\Illuminate\Routing\Route $route = null): // Rebuild the URL $url = str_replace('?' . $queryString, '', $url); - $url .= '?' . http_build_query($queryParameters); + if(!empty($queryParameters)) { + $url .= '?' . http_build_query($queryParameters); + } return $url; }