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

Method relativeAuthID

internal/store/postgresstore.go:595–611  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

593}
594
595func (s *PostgresStore) relativeAuthID(path string) (string, error) {
596 if s == nil {
597 return "", fmt.Errorf("postgres store: store not initialized")
598 }
599 if !filepath.IsAbs(path) {
600 path = filepath.Join(s.authDir, path)
601 }
602 clean := filepath.Clean(path)
603 rel, err := filepath.Rel(s.authDir, clean)
604 if err != nil {
605 return "", fmt.Errorf("postgres store: compute relative path: %w", err)
606 }
607 if strings.HasPrefix(rel, "..") {
608 return "", fmt.Errorf("postgres store: path %s outside managed directory", path)
609 }
610 return filepath.ToSlash(rel), nil
611}
612
613func (s *PostgresStore) absoluteAuthPath(id string) (string, error) {
614 if s == nil {

Callers 3

SaveMethod · 0.95
DeleteMethod · 0.95
PersistAuthFilesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected