MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / resolveAuthPath

Method resolveAuthPath

internal/store/postgresstore.go:564–586  ·  view source on GitHub ↗
(auth *cliproxyauth.Auth)

Source from the content-addressed store, hash-verified

562}
563
564func (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
588func (s *PostgresStore) resolveDeletePath(id string) (string, error) {
589 if strings.ContainsRune(id, os.PathSeparator) || filepath.IsAbs(id) {

Callers 1

SaveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected