Fix embedded preview chunks and serve JavaScript without gzip copies
This commit is contained in:
1 parent
6d8faa7d03
commit
6873f04bfb
8 files changed
+300
-3
No files matched your search
@@ -117,6 +117,12 @@ func getStaticHandlers(store *storage.Storage, server *settings.Server, assetsFs
|
||||
|
||||
f, err := assetsFs.Open(r.URL.Path + ".gz")
|
||||
if err != nil {
|
||||
// Compression may skip tiny chunks when gzip would make them larger.
|
||||
// Their original JavaScript is still part of the distribution.
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
http.FileServer(http.FS(assetsFs)).ServeHTTP(w, r)
|
||||
return 0, nil
|
||||
}
|
||||
return http.StatusNotFound, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
Reference in new issue
Block a user