Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a02ba66

Browse files
fix: fill session token when app is external (#17708)
Fix #17704 During the [refactoring of WorkspaceApp response type](https://github.com/coder/coder/pull/17700/files#diff-a7e67944708c3c914a24a02d515a89ecd414bfe61890468dac08abde55ba8e96R112), I updated the logic to check if the session token should be injected causing external apps to not load correctly. To also avoid future confusions, we are only going to rely on the `app.external` prop to open apps externally instead of verifying if the URL does not use the HTTP protocol. I did some research and I didn't find out a use case where it would be a problem. I'm going to refactor this code very soon to allow opening apps from the workspaces page, so I will write the tests to cover this use case there. **Not included:** During my next refactoring I'm also going to change the code to support token injections directly in the HREF instead of making it happen during the click event.
1 parent 29bce8d commit a02ba66

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

site/src/modules/resources/AppLink/AppLink.tsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,7 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
106106

107107
event.preventDefault();
108108

109-
// This is an external URI like "vscode://", so
110-
// it needs to be opened with the browser protocol handler.
111-
const shouldOpenAppExternally =
112-
app.external && app.url?.startsWith("http");
113-
114-
if (shouldOpenAppExternally) {
109+
if (app.external) {
115110
// This is a magic undocumented string that is replaced
116111
// with a brand-new session token from the backend.
117112
// This only exists for external URLs, and should only

0 commit comments

Comments
 (0)