MCPcopy
hub / github.com/filebrowser/filebrowser / parseQueryAlgorithm

Function parseQueryAlgorithm

http/raw.go:48–71  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

46}
47
48func parseQueryAlgorithm(r *http.Request) (string, archives.Archival, error) {
49 switch r.URL.Query().Get("algo") {
50 case "zip", "true", "":
51 return ".zip", archives.Zip{}, nil
52 case "tar":
53 return ".tar", archives.Tar{}, nil
54 case "targz":
55 return ".tar.gz", archives.CompressedArchive{Compression: archives.Gz{}, Archival: archives.Tar{}}, nil
56 case "tarbz2":
57 return ".tar.bz2", archives.CompressedArchive{Compression: archives.Bz2{}, Archival: archives.Tar{}}, nil
58 case "tarxz":
59 return ".tar.xz", archives.CompressedArchive{Compression: archives.Xz{}, Archival: archives.Tar{}}, nil
60 case "tarlz4":
61 return ".tar.lz4", archives.CompressedArchive{Compression: archives.Lz4{}, Archival: archives.Tar{}}, nil
62 case "tarsz":
63 return ".tar.sz", archives.CompressedArchive{Compression: archives.Sz{}, Archival: archives.Tar{}}, nil
64 case "tarbr":
65 return ".tar.br", archives.CompressedArchive{Compression: archives.Brotli{}, Archival: archives.Tar{}}, nil
66 case "tarzst":
67 return ".tar.zst", archives.CompressedArchive{Compression: archives.Zstd{}, Archival: archives.Tar{}}, nil
68 default:
69 return "", nil, errors.New("format not implemented")
70 }
71}
72
73func setContentDisposition(w http.ResponseWriter, r *http.Request, file *files.FileInfo) {
74 if r.URL.Query().Get("inline") == "true" {

Callers 1

rawDirHandlerFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected