From ec5891a029fa0732328a50e0a8765ad0ac3559e7 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sun, 10 Dec 2023 18:28:44 -0500 Subject: [PATCH] refactor: Trim smarter --- src/helpers/UrlHelper.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/helpers/UrlHelper.php b/src/helpers/UrlHelper.php index da8c9dcfd..5ab918480 100644 --- a/src/helpers/UrlHelper.php +++ b/src/helpers/UrlHelper.php @@ -71,8 +71,6 @@ public static function siteUrl(string $path = '', $params = null, string $scheme public static function mergeUrlWithPath(string $url, string $path): string { $overlap = 0; - $url = rtrim($url, '/'); - $path = ltrim($path, '/'); $urlOffset = strlen($url); $pathLength = strlen($path); $pathOffset = 0; @@ -84,7 +82,7 @@ public static function mergeUrlWithPath(string $url, string $path): string } } - return $url . '/' . ltrim(substr($path, $overlap), '/'); + return rtrim($url, '/') . '/' . ltrim(substr($path, $overlap), '/'); } /**