Skip to content

Commit 9227460

Browse files
committed
don't over-encode, do try to decode, fixes microsoft#85521
1 parent 16d4625 commit 9227460

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

src/vs/editor/browser/services/openerService.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,17 @@ class CommandOpener implements IOpener {
3434
// execute as command
3535
let args: any = [];
3636
try {
37-
args = parse(target.query);
38-
if (!Array.isArray(args)) {
39-
args = [args];
37+
args = parse(decodeURIComponent(target.query));
38+
} catch {
39+
// ignore and retry
40+
try {
41+
args = parse(target.query);
42+
} catch {
43+
// ignore error
4044
}
41-
} catch (e) {
42-
// ignore error
45+
}
46+
if (!Array.isArray(args)) {
47+
args = [args];
4348
}
4449
await this._commandService.executeCommand(target.path, ...args);
4550
return true;

src/vs/workbench/api/common/extHostTypeConverters.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,23 @@ export namespace MarkdownString {
289289
if (!data) {
290290
return part;
291291
}
292+
let changed = false;
292293
data = cloneAndChange(data, value => {
293294
if (URI.isUri(value)) {
294295
const key = `__uri_${Math.random().toString(16).slice(2, 8)}`;
295296
bucket[key] = value;
297+
changed = true;
296298
return key;
297299
} else {
298300
return undefined;
299301
}
300302
});
301-
return encodeURIComponent(JSON.stringify(data));
303+
304+
if (!changed) {
305+
return part;
306+
}
307+
308+
return JSON.stringify(data);
302309
}
303310

304311
export function to(value: htmlContent.IMarkdownString): vscode.MarkdownString {

0 commit comments

Comments
 (0)