Delete removes the auth file.
(ctx context.Context, id string)
| 196 | |
| 197 | // Delete removes the auth file. |
| 198 | func (s *FileTokenStore) Delete(ctx context.Context, id string) error { |
| 199 | id = strings.TrimSpace(id) |
| 200 | if id == "" { |
| 201 | return fmt.Errorf("auth filestore: id is empty") |
| 202 | } |
| 203 | path, err := s.resolveDeletePath(id) |
| 204 | if err != nil { |
| 205 | return err |
| 206 | } |
| 207 | if err = os.Remove(path); err != nil && !os.IsNotExist(err) { |
| 208 | return fmt.Errorf("auth filestore: delete failed: %w", err) |
| 209 | } |
| 210 | return nil |
| 211 | } |
| 212 | |
| 213 | func (s *FileTokenStore) resolveDeletePath(id string) (string, error) { |
| 214 | if strings.ContainsRune(id, os.PathSeparator) || filepath.IsAbs(id) { |
nothing calls this directly
no test coverage detected