diff --git a/CHANGELOG.md b/CHANGELOG.md index 4beeb2748..691331b1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ 1. [](#new) * Added `Uri::method()` to get current HTTP method (GET/POST etc) * `FormatterInterface`: Added `getSupportedFileExtensions()` and `getDefaultFileExtension()` methods - +1. [](#improved) + * Improved `Utils::url()` to support query strings + # v1.5.0-rc.1 ## 07/31/2018 diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index de0fa6157..8ed1a30c1 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -45,8 +45,15 @@ abstract class Utils /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; - // Get relative path to the resource (or false if not found). - $resource = $locator->findResource($input, false); + $parts = Uri::parseUrl($input); + + $resource = $locator->findResource("{$parts['scheme']}://{$parts['host']}{$parts['path']}", false); + + if (isset($parts['query'])) { + $resource = $resource . '?' . $parts['query']; + } + + } else { $resource = $input; }