diff --git a/src/vs/editor/test/browser/services/openerService.test.ts b/src/vs/editor/test/browser/services/openerService.test.ts index cd1e0509a6fea..53a0ae396c829 100644 --- a/src/vs/editor/test/browser/services/openerService.test.ts +++ b/src/vs/editor/test/browser/services/openerService.test.ts @@ -275,4 +275,28 @@ suite('OpenerService', function () { assert.deepStrictEqual(result.resolved.toString(), 'file:///Users/user/folder'); disposable.dispose(); }); + + test('vscode.open command can\'t open HTTP URL with hash (#) in it [extension development] #140907', async function () { + const openerService = new OpenerService(editorService, NullCommandService); + + let actual: string[] = []; + + openerService.setDefaultExternalOpener({ + async openExternal(href) { + actual.push(href); + return true; + } + }); + + const href = 'https://gitlab.com/viktomas/test-project/merge_requests/new?merge_request%5Bsource_branch%5D=test-%23-hash'; + const uri = URI.parse(href); + + assert.ok(await openerService.open(uri)); + assert.ok(await openerService.open(href)); + + assert.deepStrictEqual(actual, [ + encodeURI(uri.toString(true)), // BAD, the encoded # (%23) is double encoded to %2523 (% is double encoded) + href // good + ]); + }); });