diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-08 12:18:46 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-08 12:18:46 -0800 |
commit | 2ab6eda728180e8406916d04a0bc858c18aaafd5 (patch) | |
tree | 86ae24d4138eca1647350f80a76368aa797d07bd /modules | |
parent | 46e33f1bbe6f8526470e041658a30df6e9e6c84a (diff) |
Change file proxy to url encode the path components instead of the entire path. Otherwise, we will encode the slashes and won't find the item.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/controllers/file_proxy.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 8a4e759b..646edf17 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -56,11 +56,16 @@ class File_Proxy_Controller extends Controller { // If the last element is .album.jpg, pop that off since it's not a real item $path = preg_replace("|/.album.jpg$|", "", $path); + $encoded_path = array(); + foreach (explode("/", $path) as $path_part) { + $encoded_path[] = rawurlencode($path_part); + } // We now have the relative path to the item. Search for it in the path cache // The patch cache is urlencoded so re-encode the path. (it was decoded earlier to // insure that the paths are normalized. - $item = ORM::factory("item")->where("relative_path_cache", "=", rawurlencode($path))->find(); + $item = ORM::factory("item") + ->where("relative_path_cache", "=", implode("/", $encoded_path))->find(); if (!$item->loaded()) { // We didn't turn it up. It's possible that the relative_path_cache is out of date here. // There was fallback code, but bharat deleted it in 8f1bca74. If it turns out to be |