mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-07 23:36:03 +01:00
Add some defensive strategy to command urls in remote help
Fixes microsoft/vscode-remote-release#3612
This commit is contained in:
@@ -281,7 +281,10 @@ class HelpItemValue {
|
||||
if (url.authority) {
|
||||
this._url = this.urlOrCommand;
|
||||
} else {
|
||||
this._url = await this.commandService.executeCommand(this.urlOrCommand);
|
||||
const urlCommand: Promise<string | undefined> = this.commandService.executeCommand(this.urlOrCommand);
|
||||
// We must be defensive. The command may never return, meaning that no help at all is ever shown!
|
||||
const emptyString: Promise<string> = new Promise(resolve => setTimeout(() => resolve(''), 500));
|
||||
this._url = await Promise.race([urlCommand, emptyString]);
|
||||
}
|
||||
} else {
|
||||
this._url = '';
|
||||
@@ -326,13 +329,13 @@ abstract class HelpItemBase implements IHelpItem {
|
||||
}
|
||||
|
||||
if (this.values.length > 1) {
|
||||
let actions = await Promise.all(this.values.map(async (value) => {
|
||||
let actions = (await Promise.all(this.values.map(async (value) => {
|
||||
return {
|
||||
label: value.extensionDescription.displayName || value.extensionDescription.identifier.value,
|
||||
description: await value.url,
|
||||
extensionDescription: value.extensionDescription
|
||||
};
|
||||
}));
|
||||
}))).filter(item => item.description);
|
||||
|
||||
const action = await this.quickInputService.pick(actions, { placeHolder: nls.localize('pickRemoteExtension', "Select url to open") });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user