Index: FeedSet.php =================================================================== --- FeedSet.php (Revision 19126) +++ FeedSet.php (Arbeitskopie) @@ -89,7 +89,14 @@ { if (!Zend_Uri::check($link)) { if (!is_null($uri)) { - $link = rtrim($uri, '/') . '/' . ltrim($link, '/'); + $uri = Zend_Uri::factory($uri); + + if ($link[0] !== '/') { + $link = $uri->getPath() . '/' . $link; + } + + $link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->_canonicalizePath($link); + if (!Zend_Uri::check($link)) { $link = null; } @@ -99,6 +106,26 @@ } /** + * Canonicalize relative path + */ + protected function _canonicalizePath($path) + { + $parts = array_filter(explode('/', $path)); + $absolutes = array(); + foreach ($parts as $part) { + if ('.' == $part) { + continue; + } + if ('..' == $part) { + array_pop($absolutes); + } else { + $absolutes[] = $part; + } + } + return implode('/', $absolutes); + } + + /** * Supports lazy loading of feeds using Zend_Feed_Reader::import() but * delegates any other operations to the parent class. *