|
@@ -7,6 +7,7 @@ import (
|
|
"errors"
|
|
"errors"
|
|
"fmt"
|
|
"fmt"
|
|
"io"
|
|
"io"
|
|
|
|
+ "mime"
|
|
"net/http"
|
|
"net/http"
|
|
"os"
|
|
"os"
|
|
"path"
|
|
"path"
|
|
@@ -181,6 +182,10 @@ func (fs GCSFs) Create(name string, flag int) (*os.File, *PipeWriter, func(), er
|
|
obj := bkt.Object(name)
|
|
obj := bkt.Object(name)
|
|
ctx, cancelFn := context.WithCancel(context.Background())
|
|
ctx, cancelFn := context.WithCancel(context.Background())
|
|
objectWriter := obj.NewWriter(ctx)
|
|
objectWriter := obj.NewWriter(ctx)
|
|
|
|
+ contentType := mime.TypeByExtension(path.Ext(name))
|
|
|
|
+ if contentType != "" {
|
|
|
|
+ objectWriter.ObjectAttrs.ContentType = contentType
|
|
|
|
+ }
|
|
if len(fs.config.StorageClass) > 0 {
|
|
if len(fs.config.StorageClass) > 0 {
|
|
objectWriter.ObjectAttrs.StorageClass = fs.config.StorageClass
|
|
objectWriter.ObjectAttrs.StorageClass = fs.config.StorageClass
|
|
}
|
|
}
|