| 562 | } |
| 563 | |
| 564 | func (s *PostgresStore) resolveAuthPath(auth *cliproxyauth.Auth) (string, error) { |
| 565 | if auth == nil { |
| 566 | return "", fmt.Errorf("postgres store: auth is nil") |
| 567 | } |
| 568 | if auth.Attributes != nil { |
| 569 | if p := strings.TrimSpace(auth.Attributes["path"]); p != "" { |
| 570 | return p, nil |
| 571 | } |
| 572 | } |
| 573 | if fileName := strings.TrimSpace(auth.FileName); fileName != "" { |
| 574 | if filepath.IsAbs(fileName) { |
| 575 | return fileName, nil |
| 576 | } |
| 577 | return filepath.Join(s.authDir, fileName), nil |
| 578 | } |
| 579 | if auth.ID == "" { |
| 580 | return "", fmt.Errorf("postgres store: missing id") |
| 581 | } |
| 582 | if filepath.IsAbs(auth.ID) { |
| 583 | return auth.ID, nil |
| 584 | } |
| 585 | return filepath.Join(s.authDir, filepath.FromSlash(auth.ID)), nil |
| 586 | } |
| 587 | |
| 588 | func (s *PostgresStore) resolveDeletePath(id string) (string, error) { |
| 589 | if strings.ContainsRune(id, os.PathSeparator) || filepath.IsAbs(id) { |