go-tower: added StaticFS and fixed buildFullPath: v0.1.1
This commit is contained in:
19
path.go
19
path.go
@@ -12,3 +12,22 @@ func normalizePath(path string) string {
|
||||
|
||||
return "/" + path
|
||||
}
|
||||
|
||||
func buildFullPath(prefix string, path string) string {
|
||||
normalizedPrefix := normalizePath(prefix)
|
||||
normalizedPath := normalizePath(path)
|
||||
|
||||
if normalizedPrefix == "/" && normalizedPath == "/" {
|
||||
return "/"
|
||||
}
|
||||
|
||||
if normalizedPrefix == "/" {
|
||||
return normalizedPath
|
||||
}
|
||||
|
||||
if normalizedPath == "/" {
|
||||
return normalizedPrefix
|
||||
}
|
||||
|
||||
return normalizedPrefix + normalizedPath
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user