Redesign file context menus and download archives using global preference

This commit is contained in:
SantaSpeen committed 2026-10-22 15:35:25 +03:00
1 parent 6aca927851
commit 042392f611
22 files changed
+530 -363

No files matched your search

+11 -3
View File
@@ -38,8 +38,12 @@ func parseQueryFiles(r *http.Request, f *files.FileInfo, _ *users.User) ([]strin
return fileSlice, nil
}
func parseQueryAlgorithm(r *http.Request) (string, archives.Archival, error) {
switch r.URL.Query().Get("algo") {
func parseQueryAlgorithm(r *http.Request, defaultFormat string) (string, archives.Archival, error) {
format := r.URL.Query().Get("algo")
if format == "" || format == "true" {
format = defaultFormat
}
switch format {
case "zip", "true", "":
return ".zip", archives.Zip{}, nil
case "tar":
@@ -174,7 +178,11 @@ func rawDirHandler(w http.ResponseWriter, r *http.Request, d *data, file *files.
return http.StatusInternalServerError, err
}
extension, archiver, err := parseQueryAlgorithm(r)
format := "zip"
if d.settings != nil {
format = d.settings.ArchiveFormat()
}
extension, archiver, err := parseQueryAlgorithm(r, format)
if err != nil {
return http.StatusInternalServerError, err
}