fix bug: upload big .gz file more than maxMB

This commit is contained in:
lixianbin
2017-01-04 11:23:40 +08:00
parent f7ff98c747
commit d96d0a87cf
3 changed files with 34 additions and 33 deletions

View File

@@ -92,18 +92,15 @@ func newFilePart(fullPathFilename string) (ret FilePart, err error) {
}
ret.Reader = fh
if fi, fiErr := fh.Stat(); fiErr != nil {
fi, fiErr := fh.Stat()
if fiErr != nil {
glog.V(0).Info("Failed to stat file:", fullPathFilename)
return ret, fiErr
} else {
ret.ModTime = fi.ModTime().UTC().Unix()
ret.FileSize = fi.Size()
}
ret.ModTime = fi.ModTime().UTC().Unix()
ret.FileSize = fi.Size()
ext := strings.ToLower(path.Ext(fullPathFilename))
ret.IsGzipped = ext == ".gz"
if ret.IsGzipped {
ret.FileName = fullPathFilename[0 : len(fullPathFilename)-3]
}
ret.FileName = fullPathFilename
if ext != "" {
ret.MimeType = mime.TypeByExtension(ext)