diff --git a/CHANGELOG.md b/CHANGELOG.md index e60a4576d..e03878c07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ 1. [](#new) * Added `Blueprint::addDynamicHandler()` method to allow custom dynamic handlers, for example `custom-options@: getCustomOptions` +1. [](#bugfix) + * Missed a `CacheCommand` reference in `bin/grav` [#2442](https://github.com/getgrav/grav/issues/2442) + * Fixed issue with `Utils::normalizePath` messing with external URLs [#2216](https://github.com/getgrav/grav/issues/2216) # v1.6.2 ## 04/11/2019 diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index b23edf946..c5728b56f 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -784,6 +784,11 @@ abstract class Utils */ public static function normalizePath($path) { + + if (Uri::isExternal($path)) { + return $path; + } + $root = ''; preg_match(self::ROOTURL_REGEX, $path, $matches); if ($matches) { diff --git a/tests/unit/Grav/Common/UtilsTest.php b/tests/unit/Grav/Common/UtilsTest.php index 931f1c9ac..6c034bafd 100644 --- a/tests/unit/Grav/Common/UtilsTest.php +++ b/tests/unit/Grav/Common/UtilsTest.php @@ -225,9 +225,8 @@ class UtilsTest extends \Codeception\TestCase\Test $this->assertEquals('/test', Utils::normalizePath('/../test')); $this->assertEquals('/test2', Utils::normalizePath('/test/../test2')); $this->assertEquals('/test/test2', Utils::normalizePath('/test/./test2')); - $this->assertEquals('//something/test/test2', Utils::normalizePath('//../something/test/test2')); - $this->assertEquals('//something/test2', Utils::normalizePath('//something/test/../test2')); - $this->assertEquals('//test2', Utils::normalizePath('//something/../test/../test2')); + $this->assertEquals('https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css', Utils::normalizePath('https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css')); + $this->assertEquals('//something.com/../test/test2', Utils::normalizePath('//something.com/../test/test2')); } public function testIsFunctionDisabled()