From 71dd07c5a83b7ef1b2053cd9dd989265fa5aafb5 Mon Sep 17 00:00:00 2001 From: Nick Ivanter Date: Mon, 27 Jul 2015 16:04:25 +0300 Subject: [PATCH] Fix for protocol-relative URLs accessed over HTTPs I noticed that the plugin wouldn't pick up assets referenced by protocol-relative URLs (those omitting the http:/https: part) -- only when the website was served over HTTPS. This change fixes it. --- src/AssetsMinify/Assets/Factory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AssetsMinify/Assets/Factory.php b/src/AssetsMinify/Assets/Factory.php index c28a2b0..c089f0a 100644 --- a/src/AssetsMinify/Assets/Factory.php +++ b/src/AssetsMinify/Assets/Factory.php @@ -118,7 +118,7 @@ public function guessPath( $file_url ) { * @return string The regular expression matching the URL. */ protected function getUrlRegex( $url ) { - $regex = '@^' . str_replace( 'http\://','(https?\:)?\/\/', preg_quote( $url )) . '@'; + $regex = '@^' . str_replace( array( 'https\://', 'http\://' ), '(https?\:)?\/\/', preg_quote( $url )) . '@'; return $regex; } -} \ No newline at end of file +}