mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 21:09:24 +08:00
renaming
This commit is contained in:
@@ -81,7 +81,7 @@ func CreateNeedleFromRequest(r *http.Request, fixJpgOrientation bool, sizeLimit
|
||||
}
|
||||
}
|
||||
if pu.IsGzipped {
|
||||
n.SetGzipped()
|
||||
n.SetIsCompressed()
|
||||
}
|
||||
if n.LastModified == 0 {
|
||||
n.LastModified = uint64(time.Now().Unix())
|
||||
|
@@ -51,7 +51,7 @@ func ParseUpload(r *http.Request, sizeLimit int64) (pu *ParsedUpload, e error) {
|
||||
|
||||
pu.OriginalDataSize = len(pu.Data)
|
||||
pu.UncompressedData = pu.Data
|
||||
// println("received data", len(pu.Data), "isGzipped", pu.IsGzipped, "mime", pu.MimeType, "name", pu.FileName)
|
||||
// println("received data", len(pu.Data), "isGzipped", pu.IsCompressed, "mime", pu.MimeType, "name", pu.FileName)
|
||||
if pu.MimeType == "" {
|
||||
pu.MimeType = http.DetectContentType(pu.Data)
|
||||
// println("detected mimetype to", pu.MimeType)
|
||||
@@ -60,7 +60,7 @@ func ParseUpload(r *http.Request, sizeLimit int64) (pu *ParsedUpload, e error) {
|
||||
}
|
||||
}
|
||||
if pu.IsGzipped {
|
||||
if unzipped, e := util.UnGzipData(pu.Data); e == nil {
|
||||
if unzipped, e := util.UnCompressData(pu.Data); e == nil {
|
||||
pu.OriginalDataSize = len(unzipped)
|
||||
pu.UncompressedData = unzipped
|
||||
// println("ungzipped data size", len(unzipped))
|
||||
|
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
FlagGzip = 0x01
|
||||
FlagIsCompressed = 0x01
|
||||
FlagHasName = 0x02
|
||||
FlagHasMime = 0x04
|
||||
FlagHasLastModifiedDate = 0x08
|
||||
@@ -343,11 +343,11 @@ func (n *Needle) ReadNeedleBodyBytes(needleBody []byte, version Version) (err er
|
||||
return
|
||||
}
|
||||
|
||||
func (n *Needle) IsGzipped() bool {
|
||||
return n.Flags&FlagGzip > 0
|
||||
func (n *Needle) IsCompressed() bool {
|
||||
return n.Flags&FlagIsCompressed > 0
|
||||
}
|
||||
func (n *Needle) SetGzipped() {
|
||||
n.Flags = n.Flags | FlagGzip
|
||||
func (n *Needle) SetIsCompressed() {
|
||||
n.Flags = n.Flags | FlagIsCompressed
|
||||
}
|
||||
func (n *Needle) HasName() bool {
|
||||
return n.Flags&FlagHasName > 0
|
||||
|
Reference in New Issue
Block a user