diff options
-rw-r--r-- | phpfspot.class.php | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php index a69cdde..e220a7c 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -559,6 +559,10 @@ class PHPFSPOT { if($this->dbver < 9) { $row['uri'] = "file://". $row['directory_path'] ."/". $row['name']; } + /* starting with dbversion >= 17 we need to rawurldecode() uri */ + elseif($this->dbver >= 17) { + $row['uri'] = rawurldecode($row['uri']); + } /* if version-idx has not yet been set, get the latest photo version */ if(!isset($version_idx) || !$this->is_valid_version($idx, $version_idx)) @@ -600,7 +604,7 @@ class PHPFSPOT { version_id LIKE '". $version_idx ."'")) { $row['name'] = $version['name']; - $row['uri'] = $version['uri']; + $row['uri'] = rawurldecode($version['uri']); } } } @@ -3500,23 +3504,24 @@ class PHPFSPOT { */ public function parse_uri($uri, $mode) { - if(($components = parse_url($uri)) !== false) { + if(($components = parse_url($uri)) === false) + return $uri; - switch($mode) { - case 'filename': - return basename($components['path']); - break; - case 'dirname': - return dirname($components['path']); - break; - case 'fullpath': - return $components['path']; - break; - } + switch($mode) { + case 'filename': + return basename($components['path']); + break; + case 'dirname': + return dirname($components['path']); + break; + case 'fullpath': + return $components['path']; + break; + default: + $this->throwError("unknown mode ". $mode); + break; } - return $uri; - } // parse_uri() /** |