Browse Source

rename UnCompressData to DecompressData

pull/1371/head
Chris Lu 5 years ago
parent
commit
3080c197e3
  1. 2
      unmaintained/volume_tailer/volume_tailer.go
  2. 2
      weed/operation/chunked_file.go
  3. 2
      weed/operation/upload_content.go
  4. 4
      weed/server/volume_server_handlers_read.go
  5. 2
      weed/storage/needle/needle_parse_upload.go
  6. 2
      weed/util/compression.go
  7. 2
      weed/util/http_util.go

2
unmaintained/volume_tailer/volume_tailer.go

@ -49,7 +49,7 @@ func main() {
data := n.Data data := n.Data
if n.IsCompressed() { if n.IsCompressed() {
if data, err = util2.UnCompressData(data); err != nil {
if data, err = util2.DecompressData(data); err != nil {
return err return err
} }
} }

2
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) { func LoadChunkManifest(buffer []byte, isCompressed bool) (*ChunkManifest, error) {
if isCompressed { if isCompressed {
var err error var err error
if buffer, err = util.UnCompressData(buffer); err != nil {
if buffer, err = util.DecompressData(buffer); err != nil {
return nil, err return nil, err
} }
} }

2
weed/operation/upload_content.go

@ -121,7 +121,7 @@ func doUploadData(uploadUrl string, filename string, cipher bool, data []byte, i
} }
} else if isInputGzipped { } else if isInputGzipped {
// just to get the clear data length // just to get the clear data length
clearData, err := util.UnCompressData(data)
clearData, err := util.DecompressData(data)
if err == nil { if err == nil {
clearDataLen = len(clearData) clearDataLen = len(clearData)
} }

4
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 n.IsCompressed() {
if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") { if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
if _, _, _, shouldResize := shouldResizeImages(ext, r); shouldResize { 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) glog.V(0).Infoln("ungzip error:", err, r.URL.Path)
} }
} else { } else {
@ -155,7 +155,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
} }
} }
} else { } 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) glog.V(0).Infoln("ungzip error:", err, r.URL.Path)
} }
} }

2
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 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.OriginalDataSize = len(unzipped)
pu.UncompressedData = unzipped pu.UncompressedData = unzipped
// println("ungzipped data size", len(unzipped)) // println("ungzipped data size", len(unzipped))

2
weed/util/compression.go

@ -26,7 +26,7 @@ func GzipData(input []byte) ([]byte, error) {
} }
return buf.Bytes(), nil return buf.Bytes(), nil
} }
func UnCompressData(input []byte) ([]byte, error) {
func DecompressData(input []byte) ([]byte, error) {
if IsGzippedContent(input) { if IsGzippedContent(input) {
return ungzipData(input) return ungzipData(input)
} }

2
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) return fmt.Errorf("decrypt %s: %v", fileUrl, err)
} }
if isContentCompressed { if isContentCompressed {
decryptedData, err = UnCompressData(decryptedData)
decryptedData, err = DecompressData(decryptedData)
if err != nil { if err != nil {
return fmt.Errorf("unzip decrypt %s: %v", fileUrl, err) return fmt.Errorf("unzip decrypt %s: %v", fileUrl, err)
} }

Loading…
Cancel
Save