avoid .gz auto decompression

This commit is contained in:
Chris Lu
2018-12-22 13:58:16 -08:00
parent be946c9e54
commit 852ee21835
3 changed files with 6 additions and 20 deletions

View File

@@ -83,6 +83,9 @@ func parseMultipart(r *http.Request) (
}
if part.Header.Get("Content-Encoding") == "gzip" {
if unzipped, e := operation.UnGzipData(data); e == nil {
originalDataSize = len(unzipped)
}
isGzipped = true
} else if operation.IsGzippable(ext, mtype) {
if data, e = operation.GzipData(data); e != nil {
@@ -90,15 +93,6 @@ func parseMultipart(r *http.Request) (
}
isGzipped = true
}
if ext == ".gz" {
if strings.HasSuffix(fileName, ".css.gz") ||
strings.HasSuffix(fileName, ".html.gz") ||
strings.HasSuffix(fileName, ".txt.gz") ||
strings.HasSuffix(fileName, ".js.gz") {
fileName = fileName[:len(fileName)-3]
isGzipped = true
}
}
}
return