Skip to content

Commit f8c61ae

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

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,22 @@ 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(
111+
appDisplayName,
112+
generateRandomString(12),
113+
),
114+
"width=900,height=600",
115+
);
116+
}
106117
}
107118
: undefined
108119
}

0 commit comments

Comments
 (0)