Skip to content

Commit 145bd6f

Browse files
committed
Fix clearing the token
The previous version would have interpreted an empty token as an abort of the dialog and would have not properly cleared the token. This is now fixed by checking for `undefined` for a an abort and by setting the token to `undefined` in order to clear it.
1 parent 501b516 commit 145bd6f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

editors/code/src/main.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,13 @@ async function queryForGithubToken(state: PersistentState): Promise<void> {
393393
};
394394

395395
const newToken = await vscode.window.showInputBox(githubTokenOptions);
396-
if (newToken) {
397-
log.info("Storing new github token");
398-
await state.updateGithubToken(newToken);
396+
if (newToken !== undefined) {
397+
if (newToken === "") {
398+
log.info("Clearing github token");
399+
await state.updateGithubToken(undefined);
400+
} else {
401+
log.info("Storing new github token");
402+
await state.updateGithubToken(newToken);
403+
}
399404
}
400405
}

0 commit comments

Comments
 (0)