MCPcopy Create free account
hub / github.com/blues/note / fsNamesFromFileStorageObject

Function fsNamesFromFileStorageObject

lib/file.go:86–100  ·  view source on GitHub ↗

fsNamesFromStorageObject extracts the names from the storage object

(storageObject string)

Source from the content-addressed store, hash-verified

84
85// fsNamesFromStorageObject extracts the names from the storage object
86func fsNamesFromFileStorageObject(storageObject string) (containerName string, fileName string) {
87 // Remove the scheme
88 name := fsRemoveScheme(storageObject)
89
90 // Split the container and filename
91 str := strings.Split(name, "/")
92
93 // No container? Return the filename
94 if len(str) < 2 {
95 return "", str[0]
96 }
97
98 // Return the container and filename, associating all subdir components with the container
99 return strings.Join(str[0:len(str)-1], "/"), str[len(str)-1]
100}
101
102// FileCleanName generates a clean filename with correct extension from a filename input
103func FileCleanName(filename string) string {

Callers 2

createMethod · 0.85
fsObjectsToPathFunction · 0.85

Calls 1

fsRemoveSchemeFunction · 0.85

Tested by

no test coverage detected