1
0
Fork 0

Handle other path redirects

pull/4783/head
Chris Smith 2016-01-17 21:17:52 +00:00
parent ffab235edd
commit e830a611ec
1 changed files with 8 additions and 2 deletions

View File

@ -313,10 +313,16 @@ class RemoteFilesystem
if ('/' === $m[1][0]) { if ('/' === $m[1][0]) {
// Absolute path; e.g. /foo // Absolute path; e.g. /foo
throw new \Exception('todo'); $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
// Replace path using hostname as an anchor.
$targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).')(?:[/\?].*)?$}', '\1'.$m[1], $this->fileUrl);
} }
throw new \Exception('todo'); // Relative path; e.g. foo
// This actually differs from PHP which seems to add duplicate slashes.
$targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$m[1], $this->fileUrl);
break; break;
} }
} }