diff options
Diffstat (limited to 'weed/operation/submit.go')
| -rw-r--r-- | weed/operation/submit.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/weed/operation/submit.go b/weed/operation/submit.go index 54b6e164e..1de6b544a 100644 --- a/weed/operation/submit.go +++ b/weed/operation/submit.go @@ -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) |
