MCPcopy Create free account
hub / github.com/cli/cli / JoinPath

Function JoinPath

internal/safeurl/safeurl.go:54–59  ·  view source on GitHub ↗

JoinPath returns a SafeURL for the path made up of the given components. It returns an error if any component is exactly "..", which would traverse the URL path and change which resource it addresses.

(components ...string)

Source from the content-addressed store, hash-verified

52// returns an error if any component is exactly "..", which would traverse the URL
53// path and change which resource it addresses.
54func JoinPath(components ...string) (*MutableSafeURL, error) {
55 if err := checkTraversal(components); err != nil {
56 return nil, err
57 }
58 return &MutableSafeURL{components: components}, nil
59}
60
61// JoinPathWithHostPrefix returns a SafeURL for the given host prefix and the path
62// made up of the given components. It returns an error if any component is exactly

Callers 15

deleteCacheByIDFunction · 0.92
deleteCacheByKeyFunction · 0.92
GetCachesFunction · 0.92
viewRepoRulesetFunction · 0.92
viewOrgRulesetFunction · 0.92
checkRunFunction · 0.92
isNewReleaseFunction · 0.92
deleteLabelFunction · 0.92
createLabelFunction · 0.92
updateLabelFunction · 0.92
deleteGistFunction · 0.92
GetGistFunction · 0.92

Calls 1

checkTraversalFunction · 0.85

Tested by 5

TestMutableSafeURLStringFunction · 0.74