diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2022-09-30 13:44:27 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2022-09-30 16:03:15 +0200 |
| commit | feb5635181eb12a6e3516172a3f5af06a3bc93e1 (patch) | |
| tree | de2a1f5e796c8d25d3950d02b346f323d8d1448c /pkg/asset/storage.go | |
| parent | 5e8ac358946b8898e30bb3d9642a1ce5e5b15a5a (diff) | |
pkg/asset: don't set encoding by default
It causes web browsers to decompress archives in place, which makes it
more confusing for the users since the file extension remains in place.
The only exception is html coverage reports, adjust the code to handle
that.
Diffstat (limited to 'pkg/asset/storage.go')
| -rw-r--r-- | pkg/asset/storage.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/pkg/asset/storage.go b/pkg/asset/storage.go index e790732bd..0b008b744 100644 --- a/pkg/asset/storage.go +++ b/pkg/asset/storage.go @@ -112,6 +112,7 @@ func (storage *Storage) uploadFileStream(reader io.Reader, assetType dashapi.Ass req := &uploadRequest{ savePath: path, contentType: typeDescr.ContentType, + contentEncoding: typeDescr.ContentEncoding, preserveExtension: typeDescr.preserveExtension, } if req.contentType == "" { @@ -287,10 +288,6 @@ func xzCompressor(req *uploadRequest, if !req.preserveExtension { newReq.savePath = fmt.Sprintf("%s.xz", newReq.savePath) } - // "gz" contentEncoding is not really supported so far, so let's just set contentType. - if newReq.contentType == "" { - newReq.contentType = "application/x-xz" - } resp, err := next(&newReq) if err != nil { return nil, err @@ -342,7 +339,6 @@ func gzipCompressor(req *uploadRequest, if !req.preserveExtension { newReq.savePath = fmt.Sprintf("%s.gz", newReq.savePath) } - newReq.contentEncoding = "gzip" resp, err := next(&newReq) if err != nil { return nil, err |
