1
0
Fork 0

Encode spaces in paths to %20 instead of +

pull/140/head
Felix Becker 2016-11-07 09:52:45 +01:00
parent 9e65cd4cf0
commit b398bb02fe
2 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ function pathToUri(string $filepath): string
if (substr($first, -1) !== ':') {
$first = urlencode($first);
}
$parts = array_map('urlencode', $parts);
$parts = array_map('rawurlencode', $parts);
array_unshift($parts, $first);
$filepath = implode('/', $parts);
return 'file:///' . $filepath;

View File

@ -25,7 +25,7 @@ class FileUriTest extends TestCase
// special chars are escaped
$uri = pathToUri('c:/path/to/file/dürüm döner.php');
$this->assertEquals('file:///c:/path/to/file/d%C3%BCr%C3%BCm+d%C3%B6ner.php', $uri);
$this->assertEquals('file:///c:/path/to/file/d%C3%BCr%C3%BCm%20d%C3%B6ner.php', $uri);
//backslashes are transformed
$uri = pathToUri('c:\\foo\\bar.baz');