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

Function isRemoteDestination

internal/attachments/references.go:410–416  ·  view source on GitHub ↗

isRemoteDestination reports whether a destination addresses somewhere other than the filesystem, so that an attached file is never confused with a URI. A one letter scheme is a Windows volume rather than a scheme, which keeps "C:\pictures\login.png" a path. A host with no scheme is the protocol rel

(dest string)

Source from the content-addressed store, hash-verified

408// relative form, which inherits the scheme of the page it sits on. Anything too
409// malformed to parse is left to the path lookup, which will not match it.
410func isRemoteDestination(dest string) bool {
411 u, err := url.Parse(dest)
412 if err != nil {
413 return false
414 }
415 return len(u.Scheme) > 1 || u.Host != ""
416}
417
418// candidatePaths returns the ways a destination could name a file on disk.
419// goldmark reports the destination alone, without the angle brackets or the

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected