package dav import ( "fmt" "path/filepath" "strings" ) // optimized versions, no more marshalling func BaseDirectory(path, added string) string { return fmt.Sprintf("%s%sHTTP/1.1 200 OK", customPathEscape(path), added) } func Directory(path, added string) string { path = filepath.Base(path) return fmt.Sprintf("%s%sHTTP/1.1 200 OK", customPathEscape(path), added) } func BaseFile(path string, fileSize int64, added string) string { return fmt.Sprintf("%s%d%sHTTP/1.1 200 OK", customPathEscape(path), fileSize, added) } func File(path string, fileSize int64, added string) string { path = filepath.Base(path) return fmt.Sprintf("%s%d%sHTTP/1.1 200 OK", customPathEscape(path), fileSize, added) } func VidHubDirectory(path, added string) string { if !strings.HasSuffix(path, "/") { path += "/" } return fmt.Sprintf("%s%sHTTP/1.1 200 OK", customPathEscape2(path), added) } func VidHubFile(path string, fileSize int64, added string) string { return fmt.Sprintf("%s%d%sHTTP/1.1 200 OK", customPathEscape2(path), fileSize, added) }