提交 df69b899 编写于 作者: J Johannes Rieken

Revert "add `_encodeDriveLetterColon` to toString #61504"

This reverts commit c537eaa1.
上级 c537eaa1
......@@ -346,8 +346,8 @@ export class URI implements UriComponents {
*
* @param skipEncoding Do not encode the result, default is `false`
*/
public toString(skipEncoding: boolean = false, _encodeDriveLetterColon: boolean = false): string {
return _asFormatted(this, skipEncoding, _encodeDriveLetterColon);
public toString(skipEncoding: boolean = false): string {
return _asFormatted(this, skipEncoding);
}
public toJSON(): object {
......@@ -398,15 +398,15 @@ class _URI extends URI {
return this._fsPath;
}
toString(skipEncoding: boolean = false, _encodeDriveLetterColon: boolean = false): string {
if (!skipEncoding && !_encodeDriveLetterColon) {
public toString(skipEncoding: boolean = false): string {
if (!skipEncoding) {
if (!this._formatted) {
this._formatted = _asFormatted(this, false, _encodeDriveLetterColon);
this._formatted = _asFormatted(this, false);
}
return this._formatted;
} else {
// we don't cache that
return _asFormatted(this, true, _encodeDriveLetterColon);
return _asFormatted(this, true);
}
}
......@@ -575,7 +575,7 @@ function _makeFsPath(uri: URI): string {
/**
* Create the external version of a uri
*/
function _asFormatted(uri: URI, skipEncoding: boolean, encodeDriveLetterColon: boolean): string {
function _asFormatted(uri: URI, skipEncoding: boolean): string {
const encoder = !skipEncoding
? encodeURIComponentFast
......@@ -639,7 +639,7 @@ function _asFormatted(uri: URI, skipEncoding: boolean, encodeDriveLetterColon: b
encodeOffset = 2;
}
}
if (scheme !== 'file' || encodeDriveLetterColon || path.length > encodeOffset && path.charCodeAt(encodeOffset) !== CharCode.Slash) {
if (scheme !== 'file' || path.length > encodeOffset && path.charCodeAt(encodeOffset) !== CharCode.Slash) {
encodeOffset = 0;
}
......
......@@ -490,13 +490,4 @@ suite('URI', () => {
});
test('Storage: workspace identifier changed (URI.toString()) #61504', function () {
if (isWindows) {
const uri = URI.file('c:\\Users\\bpasero\\Desktop\\Golda\'s Kitchen\\CHANGELOG.md');
assert.ok(uri.toString().indexOf('%3A') < 0);
assert.ok(uri.toString(false, false).indexOf('%3A') < 0);
assert.ok(uri.toString(false, true).indexOf('%3A') > 0);
}
});
});
......@@ -192,7 +192,7 @@ declare namespace monaco {
*
* @param skipEncoding Do not encode the result, default is `false`
*/
toString(skipEncoding?: boolean, _encodeDriveLetterColon?: boolean): string;
toString(skipEncoding?: boolean): string;
toJSON(): object;
static revive(data: UriComponents | any): Uri;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册