Skip to content

Commit 5e0c6f3

Browse files
committed
Fix issue where logout URLs do not include base query param.
1 parent 746dc5c commit 5e0c6f3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/vs/workbench/browser/client.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import { AuthType } from 'vs/base/common/auth';
88
import { Disposable } from 'vs/base/common/lifecycle';
9+
import { isFalsyOrWhitespace } from 'vs/base/common/strings';
910
import { localize } from 'vs/nls';
1011
import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
1112
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
@@ -181,9 +182,18 @@ export class CodeServerClientAdditions extends Disposable {
181182
this.contextKeyService.createKey(CodeServerClientAdditions.AUTH_KEY, auth === AuthType.Password);
182183

183184
CommandsRegistry.registerCommand(CodeServerClientAdditions.LOGOUT_COMMAND_ID, () => {
184-
if (logoutEndpointUrl) {
185-
window.location.href = logoutEndpointUrl;
185+
if (isFalsyOrWhitespace(logoutEndpointUrl)) {
186+
throw new Error('Logout URL not provided in product configuration');
186187
}
188+
189+
/**
190+
* @file 'code-server/src/node/route/logout.ts'
191+
*/
192+
const logoutUrl = new URL(logoutEndpointUrl!, window.location.href);
193+
// Add base param as this session may be stored within a nested path.
194+
logoutUrl.searchParams.set('base', window.location.pathname);
195+
196+
window.location.assign(logoutUrl);
187197
});
188198

189199
for (const menuId of [MenuId.CommandPalette, MenuId.MenubarHomeMenu]) {

0 commit comments

Comments
 (0)