diff --git a/http/static.go b/http/static.go index 25f8539d..f544618b 100644 --- a/http/static.go +++ b/http/static.go @@ -1,19 +1,19 @@ package fbhttp import ( + "compress/gzip" "encoding/json" "errors" "fmt" - "io/fs" + "html/template" "io" - "compress/gzip" + "io/fs" "log" "net/http" "os" "path" "path/filepath" "strings" - "text/template" "github.com/filebrowser/filebrowser/v2/auth" "github.com/filebrowser/filebrowser/v2/settings" @@ -153,7 +153,7 @@ func getStaticHandlers(store *storage.Storage, server *settings.Server, assetsFs defer f.Close() acceptEncoding := r.Header.Get("Accept-Encoding") - if strings.Contains(acceptEncoding, "gzip") { + if strings.Contains(acceptEncoding, "gzip") { w.Header().Set("Content-Encoding", "gzip") w.Header().Set("Content-Type", "application/javascript; charset=utf-8") @@ -168,7 +168,7 @@ func getStaticHandlers(store *storage.Storage, server *settings.Server, assetsFs defer gzReader.Close() w.Header().Set("Content-Type", "application/javascript; charset=utf-8") - + if _, err := io.Copy(w, gzReader); err != nil { return http.StatusInternalServerError, err }