File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 6
6
7
7
import { AuthType } from 'vs/base/common/auth' ;
8
8
import { Disposable } from 'vs/base/common/lifecycle' ;
9
+ import { isFalsyOrWhitespace } from 'vs/base/common/strings' ;
9
10
import { localize } from 'vs/nls' ;
10
11
import { MenuId , MenuRegistry } from 'vs/platform/actions/common/actions' ;
11
12
import { CommandsRegistry } from 'vs/platform/commands/common/commands' ;
@@ -181,9 +182,18 @@ export class CodeServerClientAdditions extends Disposable {
181
182
this . contextKeyService . createKey ( CodeServerClientAdditions . AUTH_KEY , auth === AuthType . Password ) ;
182
183
183
184
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' ) ;
186
187
}
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 ) ;
187
197
} ) ;
188
198
189
199
for ( const menuId of [ MenuId . CommandPalette , MenuId . MenubarHomeMenu ] ) {
You can’t perform that action at this time.
0 commit comments