fix(auth): preserve extra scopes replay and satisfy lint on current main (#421) (thanks @peteradams2026)
This commit is contained in:
parent
b10c81a989
commit
2bd8c347d0
@ -427,11 +427,12 @@ func writeWatchState(ctx context.Context, state gmailWatchState, showSecrets boo
|
||||
u.Out().Printf("hook_max_bytes\t%d", state.Hook.MaxBytes)
|
||||
}
|
||||
if state.Hook.Token != "" {
|
||||
if showSecrets {
|
||||
switch {
|
||||
case showSecrets:
|
||||
u.Out().Printf("hook_token\t%s", state.Hook.Token)
|
||||
} else if len(state.Hook.Token) > 4 {
|
||||
case len(state.Hook.Token) > 4:
|
||||
u.Out().Printf("hook_token\t%s...(%d chars)", state.Hook.Token[:4], len(state.Hook.Token))
|
||||
} else {
|
||||
default:
|
||||
u.Out().Printf("hook_token\t[REDACTED]")
|
||||
}
|
||||
}
|
||||
|
||||
@ -391,6 +391,7 @@ func ScopesForManageWithOptions(services []Service, opts ScopeOptions) ([]string
|
||||
if len(opts.ExtraScopes) > 0 {
|
||||
merged = mergeScopes(merged, opts.ExtraScopes)
|
||||
}
|
||||
|
||||
return merged, nil
|
||||
}
|
||||
|
||||
|
||||
@ -519,6 +519,7 @@ func TestScopesForManageWithOptions_ExtraScopes(t *testing.T) {
|
||||
|
||||
// De-duplication: gmail.readonly should appear exactly once
|
||||
count := 0
|
||||
|
||||
for _, s := range scopes {
|
||||
if s == "https://www.googleapis.com/auth/gmail.readonly" {
|
||||
count++
|
||||
|
||||
Loading…
Reference in New Issue
Block a user