diff options
| author | Chris Lu <chris.lu@gmail.com> | 2013-07-29 10:09:36 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2013-07-29 10:09:36 -0700 |
| commit | e94d52c1af1a97dfe849a70cf7fe6bec2fb5c97f (patch) | |
| tree | 5a3f6e7aee0f707929f4ab4bc01accc9c02eb3e2 /go/weed | |
| parent | fb53ec30f7c6dc6b2bce8640eeaf7b2fb09678ea (diff) | |
| download | seaweedfs-e94d52c1af1a97dfe849a70cf7fe6bec2fb5c97f.tar.xz seaweedfs-e94d52c1af1a97dfe849a70cf7fe6bec2fb5c97f.zip | |
replicate mime type
Diffstat (limited to 'go/weed')
| -rw-r--r-- | go/weed/upload.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/go/weed/upload.go b/go/weed/upload.go index 0745f62c5..67bb9adea 100644 --- a/go/weed/upload.go +++ b/go/weed/upload.go @@ -6,11 +6,13 @@ import ( "encoding/json" "errors" "fmt" + "mime" "net/url" "os" "path" "path/filepath" "strconv" + "strings" ) var ( @@ -95,7 +97,8 @@ func upload(filename string, server string, fid string) (int, error) { if isGzipped { filename = filename[0 : len(filename)-3] } - ret, e := operation.Upload("http://"+server+"/"+fid+"?ts="+strconv.Itoa(int(fi.ModTime().Unix())), filename, fh, isGzipped) + mtype := mime.TypeByExtension(strings.ToLower(filepath.Ext(filename))) + ret, e := operation.Upload("http://"+server+"/"+fid+"?ts="+strconv.Itoa(int(fi.ModTime().Unix())), filename, fh, isGzipped, mtype) if e != nil { return 0, e } |
