1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

Factor Mime Type guessing into fs.MimeType()

This commit is contained in:
Nick Craig-Wood
2015-03-01 12:38:31 +00:00
parent fe68737268
commit 46d39ebaf7
4 changed files with 15 additions and 27 deletions

View File

@@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"mime"
"net/http"
"path"
"regexp"
@@ -536,13 +535,7 @@ func (o *FsObjectS3) Update(in io.Reader, modTime time.Time, size int64) error {
metaMtime: swift.TimeToFloatString(modTime),
}
// Guess the content type
contentType := mime.TypeByExtension(path.Ext(o.remote))
if contentType == "" {
contentType = "application/octet-stream"
}
_, err := o.s3.b.PutReaderHeaders(o.s3.root+o.remote, in, size, contentType, o.s3.perm, headers)
_, err := o.s3.b.PutReaderHeaders(o.s3.root+o.remote, in, size, fs.MimeType(o), o.s3.perm, headers)
if err != nil {
return err
}