Encode spaces in paths to %20 instead of +
parent
9e65cd4cf0
commit
b398bb02fe
|
@ -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;
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue