rename UnCompressData to DecompressData

This commit is contained in:
Chris Lu 2020-06-20 08:16:16 -07:00
parent 97239ce6f1
commit 3080c197e3
7 changed files with 8 additions and 8 deletions

View file

@ -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
}
}

View file

@ -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
}
}

View file

@ -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)
}

View file

@ -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)
}
}

View file

@ -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))

View file

@ -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)
}

View file

@ -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)
}