提交 612fdf5b 编写于 作者: J Johannes Rieken

fix missing #-encode in URI.file factory

上级 96aee260
......@@ -343,6 +343,7 @@ export class URI implements UriComponents {
// escape some vital characters
authority = authority.replace(/%/g, '%25');
path = path.replace(/%/g, '%25');
path = path.replace(/#/g, '%23');
if (!isWindows) {
path = path.replace(/\\/g, '%5C');
......
......@@ -528,6 +528,7 @@ suite('URI', () => {
assertFileUri('/foo/%A0.txt'); // %A0 -> invalid
assertFileUri('/foo/ü.txt');
assertFileUri('/foo/ß.txt');
assertFileUri('/my/c#project/d.cs');
// assertFileUri('foo'); nodejs resolves the path first
if (!isWindows) {
assertFileUri('/c\\win\\path');
......@@ -541,6 +542,7 @@ suite('URI', () => {
assertFsPath('file:///foö/bar');
assertFsPath('file:///fo%C3%B6/bar');
assertFsPath('file:///');
assertFsPath('file:///my/c%23project/c.cs');
// assertFsPath('file:///fo%2f/bar'); not allowed in nodejs
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册