提交 8283078f 编写于 作者: M Matt Bierner

Make sure window's opener service resolves uris instead of automatically resolving all uris

上级 578c4c0a
...@@ -58,18 +58,16 @@ export class OpenerService extends Disposable implements IOpenerService { ...@@ -58,18 +58,16 @@ export class OpenerService extends Disposable implements IOpenerService {
} }
} }
const { resolved } = await this.resolveExternalUri(resource, options);
// check with contributed openers // check with contributed openers
for (const opener of this._openers.toArray()) { for (const opener of this._openers.toArray()) {
const handled = await opener.open(resolved, options); const handled = await opener.open(resource, options);
if (handled) { if (handled) {
return true; return true;
} }
} }
// use default openers // use default openers
return this._doOpen(resolved, options); return this._doOpen(resource, options);
} }
public async resolveExternalUri(resource: URI, options?: { readonly allowTunneling?: boolean }): Promise<{ resolved: URI, dispose(): void }> { public async resolveExternalUri(resource: URI, options?: { readonly allowTunneling?: boolean }): Promise<{ resolved: URI, dispose(): void }> {
...@@ -138,7 +136,8 @@ export class OpenerService extends Disposable implements IOpenerService { ...@@ -138,7 +136,8 @@ export class OpenerService extends Disposable implements IOpenerService {
} }
private async _doOpenExternal(resource: URI, options: OpenOptions | undefined): Promise<boolean> { private async _doOpenExternal(resource: URI, options: OpenOptions | undefined): Promise<boolean> {
dom.windowOpenNoOpener(encodeURI(resource.toString(true))); const { resolved } = await this.resolveExternalUri(resource, options);
dom.windowOpenNoOpener(encodeURI(resolved.toString(true)));
return Promise.resolve(true); return Promise.resolve(true);
} }
......
...@@ -425,10 +425,11 @@ export class ElectronWindow extends Disposable { ...@@ -425,10 +425,11 @@ export class ElectronWindow extends Disposable {
// we handle this resource by delegating the opening to // we handle this resource by delegating the opening to
// the main process to prevent window focus issues. // the main process to prevent window focus issues.
if (this.shouldOpenExternal(resource, options)) { if (this.shouldOpenExternal(resource, options)) {
const success = await this.windowsService.openExternal(encodeURI(resource.toString(true))); const { resolved } = await this.openerService.resolveExternalUri(resource);
if (!success && resource.scheme === Schemas.file) { const success = await this.windowsService.openExternal(encodeURI(resolved.toString(true)));
if (!success && resolved.scheme === Schemas.file) {
// if opening failed, and this is a file, we can still try to reveal it // if opening failed, and this is a file, we can still try to reveal it
await this.electronService.showItemInFolder(resource.fsPath); await this.electronService.showItemInFolder(resolved.fsPath);
} }
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册