feat: only delete if the secret is present in the keychain

create-reload-action
James Houlahan 5 years ago
parent e50d1d01da
commit 5380edeeb9
  1. 11
      pkg/keychain/keychain.go

@ -102,10 +102,19 @@ func (kc *Keychain) List() ([]string, error) {
return userIDs, nil
}
func (kc *Keychain) Delete(userID string) (err error) {
func (kc *Keychain) Delete(userID string) error {
kc.locker.Lock()
defer kc.locker.Unlock()
userIDsByURL, err := kc.helper.List()
if err != nil {
return err
}
if _, ok := userIDsByURL[kc.secretURL(userID)]; !ok {
return nil
}
return kc.helper.Delete(kc.secretURL(userID))
}

Loading…
Cancel
Save