Skip to content

Commit

Permalink
refactor: Trim smarter
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Dec 10, 2023
1 parent 17b8b95 commit ec5891a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/helpers/UrlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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), '/');
}

/**
Expand Down

0 comments on commit ec5891a

Please sign in to comment.