Skip to content

Commit 3cebec6

Browse files
fix: do not reject unknown schemes in WindowStateExt.asExternalUri
Fixes #12821
1 parent bf93b29 commit 3cebec6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/plugin-ext/src/plugin/window-state.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { WindowState } from '@theia/plugin';
1919
import { WindowStateExt, WindowMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
2020
import { Event, Emitter } from '@theia/core/lib/common/event';
2121
import { RPCProtocol } from '../common/rpc-protocol';
22-
import { Schemes } from '../common/uri-components';
2322

2423
export class WindowStateExtImpl implements WindowStateExt {
2524

@@ -50,16 +49,17 @@ export class WindowStateExtImpl implements WindowStateExt {
5049
}
5150

5251
openUri(uri: URI): Promise<boolean> {
52+
if (!uri.scheme.trim().length) {
53+
throw new Error('Invalid scheme - cannot be empty');
54+
}
55+
5356
return this.proxy.$openUri(uri);
5457
}
5558

5659
async asExternalUri(target: URI): Promise<URI> {
5760
if (!target.scheme.trim().length) {
5861
throw new Error('Invalid scheme - cannot be empty');
5962
}
60-
if (Schemes.http !== target.scheme && Schemes.https !== target.scheme) {
61-
throw new Error(`Invalid scheme '${target.scheme}'`);
62-
}
6363

6464
const uri = await this.proxy.$asExternalUri(target);
6565
return URI.revive(uri);

0 commit comments

Comments
 (0)