Skip to content

Don't append CSPCHD for web applications that don't support it by default #1420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions src/commands/serverActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,11 @@ export async function serverActions(): Promise<void> {
}
switch (action.id) {
case "openPortal": {
const token = await getCSPToken(api, portalPath);
vscode.env.openExternal(vscode.Uri.parse(`${serverUrl}${portalPath}&CSPCHD=${token}`));
vscode.env.openExternal(vscode.Uri.parse(`${serverUrl}${portalPath}`));
break;
}
case "openClassReference": {
const token = await getCSPToken(api, classRef);
vscode.env.openExternal(vscode.Uri.parse(`${serverUrl}${classRef}&CSPCHD=${token}`));
vscode.env.openExternal(vscode.Uri.parse(`${serverUrl}${classRef}`));
break;
}
case "openStudioAddin": {
Expand Down Expand Up @@ -284,16 +282,7 @@ export async function serverActions(): Promise<void> {
break;
}
default: {
let url = vscode.Uri.parse(action.detail);
if (action.rawLink?.startsWith("${serverUrl}")) {
const token = await getCSPToken(api, url.path);
if (token.length > 0) {
url = url.with({
query: url.query.length ? `${url.query}&CSPCHD=${token}` : `CSPCHD=${token}`,
});
}
}
vscode.env.openExternal(url);
vscode.env.openExternal(vscode.Uri.parse(action.detail));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest retaining CSPCHD for the default case, since these could be links to user-defined apps which can use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I'll put it back.

}
}
});
Expand Down