Skip to content

Commit

Permalink
fix: do not reject unknown schemes in WindowStateExt.asExternalUri
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandraBuzila committed Nov 6, 2023
1 parent f33547e commit c341da0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/plugin-ext/src/plugin/window-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ export class WindowStateExtImpl implements WindowStateExt {
}

openUri(uri: URI): Promise<boolean> {
if (!uri.scheme.trim().length) {
throw new Error('Invalid scheme - cannot be empty');
}

if (Schemes.http !== uri.scheme && Schemes.https !== uri.scheme) {
throw new Error(`Invalid scheme '${uri.scheme}'`);
}
return this.proxy.$openUri(uri);
}

async asExternalUri(target: URI): Promise<URI> {
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);
Expand Down

0 comments on commit c341da0

Please sign in to comment.