go-tower: added StaticFS and fixed buildFullPath: v0.1.1

This commit is contained in:
2026-02-15 11:48:47 +00:00
parent 3576d420d2
commit c8718716b8
3 changed files with 45 additions and 14 deletions

19
path.go
View File

@@ -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
}