提交 0f5e474b 编写于 作者: J Johannes Rieken

Uri#fsPath should be empty when path is empty, fixes #10780

上级 c4b30980
......@@ -126,7 +126,7 @@ export default class URI {
get fsPath() {
if (!this._fsPath) {
var value: string;
if (this._authority && this.scheme === 'file') {
if (this._authority && this._path && this.scheme === 'file') {
// unc path: file://shares/c$/far/boo
value = `//${this._authority}${this._path}`;
} else if (URI._driveLetterPath.test(this._path)) {
......
......@@ -28,6 +28,13 @@ suite('URI', () => {
assert.equal(URI.file('c:\\win/path').fsPath.replace(/\\/g, '/'), 'c:/win/path');
});
test('URI#fsPath - no `fsPath` when no `path`', () => {
const value = URI.parse('file://%2Fhome%2Fticino%2Fdesktop%2Fcpluscplus%2Ftest.cpp');
assert.equal(value.authority, '/home/ticino/desktop/cpluscplus/test.cpp');
assert.equal(value.path, '');
assert.equal(value.fsPath, '');
});
test('http#toString', () => {
assert.equal(URI.from({ scheme: 'http', authority: 'www.msft.com', path: '/my/path' }).toString(), 'http://www.msft.com/my/path');
assert.equal(URI.from({ scheme: 'http', authority: 'www.msft.com', path: '/my/path' }).toString(), 'http://www.msft.com/my/path');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册