diff --git a/packages/plugin-ext/src/plugin/window-state.ts b/packages/plugin-ext/src/plugin/window-state.ts index 160356282c8e9..4b4e58aac3bbd 100644 --- a/packages/plugin-ext/src/plugin/window-state.ts +++ b/packages/plugin-ext/src/plugin/window-state.ts @@ -19,7 +19,6 @@ import { WindowState } from '@theia/plugin'; import { WindowStateExt, WindowMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc'; import { Event, Emitter } from '@theia/core/lib/common/event'; import { RPCProtocol } from '../common/rpc-protocol'; -import { Schemes } from '../common/uri-components'; export class WindowStateExtImpl implements WindowStateExt { @@ -50,6 +49,10 @@ export class WindowStateExtImpl implements WindowStateExt { } openUri(uri: URI): Promise { + if (!uri.scheme.trim().length) { + throw new Error('Invalid scheme - cannot be empty'); + } + return this.proxy.$openUri(uri); } @@ -57,9 +60,6 @@ export class WindowStateExtImpl implements WindowStateExt { if (!target.scheme.trim().length) { throw new Error('Invalid scheme - cannot be empty'); } - if (Schemes.http !== target.scheme && Schemes.https !== target.scheme) { - throw new Error(`Invalid scheme '${target.scheme}'`); - } const uri = await this.proxy.$asExternalUri(target); return URI.revive(uri);