MCPcopy Create free account
hub / github.com/devld/go-drive / CleanPath

Function CleanPath

common/utils/utils.go:52–57  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

50var unsafePathCharsRegexp = regexp.MustCompile(`[\x00-\x1f\x7f-\x9f]+`)
51
52func CleanPath(path string) string {
53 path = unsafePathCharsRegexp.ReplaceAllLiteralString(strings.TrimSpace(path), "")
54 // Clean the path as if it were rooted. This prevents leading parent
55 // components (including a final "..") from surviving the cleanup.
56 return strings.TrimPrefix(path2.Clean("/"+path), "/")
57}
58
59func PathExt(name string) string {
60 ext := path2.Ext(name)

Callers 15

updateSearcherIndexesMethod · 0.92
SignatureAuthFunction · 0.92
listMethod · 0.92
getMethod · 0.92
makeDirMethod · 0.92
copyEntryMethod · 0.92
moveMethod · 0.92
deleteEntryMethod · 0.92
uploadMethod · 0.92
getContentMethod · 0.92
zipDownloadMethod · 0.92
getThumbnailMethod · 0.92

Calls

no outgoing calls

Tested by 1