From fe2aebf831dace839a61548455985d63a64a767c Mon Sep 17 00:00:00 2001 From: Stephen Holdaway Date: Wed, 10 Jul 2013 13:33:31 +1200 Subject: [PATCH] UPDATE: Remove / + and = characters from hash for URL --- README.md | 2 +- code/HashPathExtension.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d2930ca..3f76b93 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The following is required in your root `.htaccess` file. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^(.+)\.(v[A-Za-z0-9\+]+)\.(js|css|png|jpg|gif)$ $1.$3 [L] + RewriteRule ^(.+)\.(v[A-Za-z0-9]+)\.(js|css|png|jpg|gif)$ $1.$3 [L] ``` diff --git a/code/HashPathExtension.php b/code/HashPathExtension.php index 16e4cc6..56d3da2 100644 --- a/code/HashPathExtension.php +++ b/code/HashPathExtension.php @@ -43,7 +43,7 @@ public function HashFile($path, $theme = true) if (file_exists($path)) { $hash = md5_file($path); - return preg_replace('/=+$/', '', base64_encode(pack('H*', $hash))); + return str_replace(array('/', '+','='), '', base64_encode(pack('H*', $hash))); } return '';