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

Method resolveAuthPath

internal/store/gitstore.go:522–551  ·  view source on GitHub ↗
(auth *cliproxyauth.Auth)

Source from the content-addressed store, hash-verified

520}
521
522func (s *GitTokenStore) resolveAuthPath(auth *cliproxyauth.Auth) (string, error) {
523 if auth == nil {
524 return "", fmt.Errorf("auth filestore: auth is nil")
525 }
526 if auth.Attributes != nil {
527 if p := strings.TrimSpace(auth.Attributes["path"]); p != "" {
528 return p, nil
529 }
530 }
531 if fileName := strings.TrimSpace(auth.FileName); fileName != "" {
532 if filepath.IsAbs(fileName) {
533 return fileName, nil
534 }
535 if dir := s.baseDirSnapshot(); dir != "" {
536 return filepath.Join(dir, fileName), nil
537 }
538 return fileName, nil
539 }
540 if auth.ID == "" {
541 return "", fmt.Errorf("auth filestore: missing id")
542 }
543 if filepath.IsAbs(auth.ID) {
544 return auth.ID, nil
545 }
546 dir := s.baseDirSnapshot()
547 if dir == "" {
548 return "", fmt.Errorf("auth filestore: directory not configured")
549 }
550 return filepath.Join(dir, auth.ID), nil
551}
552
553func (s *GitTokenStore) labelFor(metadata map[string]any) string {
554 if metadata == nil {

Callers 1

SaveMethod · 0.95

Calls 1

baseDirSnapshotMethod · 0.95

Tested by

no test coverage detected