MCPcopy Index your code
hub / github.com/larksuite/cli / isLocalFileSrc

Function isLocalFileSrc

shortcuts/mail/draft/patch.go:995–1004  ·  view source on GitHub ↗

isLocalFileSrc returns true if src is a local file path. Any URI with a scheme (http:, cid:, data:, ftp:, blob:, file:, etc.) or protocol-relative URL (//host/...) is rejected.

(src string)

Source from the content-addressed store, hash-verified

993// Any URI with a scheme (http:, cid:, data:, ftp:, blob:, file:, etc.)
994// or protocol-relative URL (//host/...) is rejected.
995func isLocalFileSrc(src string) bool {
996 trimmed := strings.TrimSpace(src)
997 if trimmed == "" {
998 return false
999 }
1000 if strings.HasPrefix(trimmed, "//") {
1001 return false
1002 }
1003 return !uriSchemeRegexp.MatchString(trimmed)
1004}
1005
1006// generateCID returns a random UUID string suitable for use as a Content-ID.
1007// UUIDs contain only [0-9a-f-], which is inherently RFC-safe and unique,

Callers 2

ResolveLocalImagePathsFunction · 0.85
TestIsLocalFileSrcFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsLocalFileSrcFunction · 0.68