aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/api/client/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/api/client/client.go')
-rw-r--r--swarm/api/client/client.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/swarm/api/client/client.go b/swarm/api/client/client.go
index a6666144a..47a6980de 100644
--- a/swarm/api/client/client.go
+++ b/swarm/api/client/client.go
@@ -24,7 +24,6 @@ import (
"fmt"
"io"
"io/ioutil"
- "mime"
"mime/multipart"
"net/http"
"net/textproto"
@@ -124,10 +123,16 @@ func Open(path string) (*File, error) {
f.Close()
return nil, err
}
+
+ contentType, err := api.DetectContentType(f.Name(), f)
+ if err != nil {
+ return nil, err
+ }
+
return &File{
ReadCloser: f,
ManifestEntry: api.ManifestEntry{
- ContentType: mime.TypeByExtension(filepath.Ext(path)),
+ ContentType: contentType,
Mode: int64(stat.Mode()),
Size: stat.Size(),
ModTime: stat.ModTime(),