Skip to content

Commit 21426b6

Browse files
committed
fix: make non-http external app links open in the current window
1 parent 6f0e2a7 commit 21426b6

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

site/src/components/Resources/AppLink/AppLink.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,19 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
9898
canClick
9999
? (event) => {
100100
event.preventDefault();
101-
window.open(
102-
href,
103-
Language.appTitle(appDisplayName, generateRandomString(12)),
104-
"width=900,height=600",
105-
);
101+
// This is an external URI like "vscode://", so
102+
// it needs to be opened with the browser protocol handler.
103+
if (app.external && !app.url.startsWith("http")) {
104+
// If the protocol is external the browser does not
105+
// redirect the user from the page.
106+
window.location.href = href
107+
} else {
108+
window.open(
109+
href,
110+
Language.appTitle(appDisplayName, generateRandomString(12)),
111+
"width=900,height=600",
112+
);
113+
}
106114
}
107115
: undefined
108116
}

0 commit comments

Comments
 (0)