From 3080c197e3e75dfd48ce2bda08c46d1f6423e65c Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 20 Jun 2020 08:16:16 -0700 Subject: [PATCH] rename UnCompressData to DecompressData --- unmaintained/volume_tailer/volume_tailer.go | 2 +- weed/operation/chunked_file.go | 2 +- weed/operation/upload_content.go | 2 +- weed/server/volume_server_handlers_read.go | 4 ++-- weed/storage/needle/needle_parse_upload.go | 2 +- weed/util/compression.go | 2 +- weed/util/http_util.go | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/unmaintained/volume_tailer/volume_tailer.go b/unmaintained/volume_tailer/volume_tailer.go index 9458ea6c7..e93f1cc13 100644 --- a/unmaintained/volume_tailer/volume_tailer.go +++ b/unmaintained/volume_tailer/volume_tailer.go @@ -49,7 +49,7 @@ func main() { data := n.Data if n.IsCompressed() { - if data, err = util2.UnCompressData(data); err != nil { + if data, err = util2.DecompressData(data); err != nil { return err } } diff --git a/weed/operation/chunked_file.go b/weed/operation/chunked_file.go index 3ee8f5079..653b7bf13 100644 --- a/weed/operation/chunked_file.go +++ b/weed/operation/chunked_file.go @@ -56,7 +56,7 @@ func (s ChunkList) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func LoadChunkManifest(buffer []byte, isCompressed bool) (*ChunkManifest, error) { if isCompressed { var err error - if buffer, err = util.UnCompressData(buffer); err != nil { + if buffer, err = util.DecompressData(buffer); err != nil { return nil, err } } diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go index 8c8b02a8f..1ed240836 100644 --- a/weed/operation/upload_content.go +++ b/weed/operation/upload_content.go @@ -121,7 +121,7 @@ func doUploadData(uploadUrl string, filename string, cipher bool, data []byte, i } } else if isInputGzipped { // just to get the clear data length - clearData, err := util.UnCompressData(data) + clearData, err := util.DecompressData(data) if err == nil { clearDataLen = len(clearData) } diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.go index d20cd5670..aff1eab8d 100644 --- a/weed/server/volume_server_handlers_read.go +++ b/weed/server/volume_server_handlers_read.go @@ -146,7 +146,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) if n.IsCompressed() { if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") { if _, _, _, shouldResize := shouldResizeImages(ext, r); shouldResize { - if n.Data, err = util.UnCompressData(n.Data); err != nil { + if n.Data, err = util.DecompressData(n.Data); err != nil { glog.V(0).Infoln("ungzip error:", err, r.URL.Path) } } else { @@ -155,7 +155,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) } } } else { - if n.Data, err = util.UnCompressData(n.Data); err != nil { + if n.Data, err = util.DecompressData(n.Data); err != nil { glog.V(0).Infoln("ungzip error:", err, r.URL.Path) } } diff --git a/weed/storage/needle/needle_parse_upload.go b/weed/storage/needle/needle_parse_upload.go index c1fb10713..67b798821 100644 --- a/weed/storage/needle/needle_parse_upload.go +++ b/weed/storage/needle/needle_parse_upload.go @@ -60,7 +60,7 @@ func ParseUpload(r *http.Request, sizeLimit int64) (pu *ParsedUpload, e error) { } } if pu.IsGzipped { - if unzipped, e := util.UnCompressData(pu.Data); e == nil { + if unzipped, e := util.DecompressData(pu.Data); e == nil { pu.OriginalDataSize = len(unzipped) pu.UncompressedData = unzipped // println("ungzipped data size", len(unzipped)) diff --git a/weed/util/compression.go b/weed/util/compression.go index ff5e3ad3f..003f06cbf 100644 --- a/weed/util/compression.go +++ b/weed/util/compression.go @@ -26,7 +26,7 @@ func GzipData(input []byte) ([]byte, error) { } return buf.Bytes(), nil } -func UnCompressData(input []byte) ([]byte, error) { +func DecompressData(input []byte) ([]byte, error) { if IsGzippedContent(input) { return ungzipData(input) } diff --git a/weed/util/http_util.go b/weed/util/http_util.go index 51748e92a..c67eb3276 100644 --- a/weed/util/http_util.go +++ b/weed/util/http_util.go @@ -310,7 +310,7 @@ func readEncryptedUrl(fileUrl string, cipherKey []byte, isContentCompressed bool return fmt.Errorf("decrypt %s: %v", fileUrl, err) } if isContentCompressed { - decryptedData, err = UnCompressData(decryptedData) + decryptedData, err = DecompressData(decryptedData) if err != nil { return fmt.Errorf("unzip decrypt %s: %v", fileUrl, err) }