parent
55515fee95
commit
cd56039ab7
1 changed files with 5 additions and 0 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
@ -181,6 +182,10 @@ func (fs GCSFs) Create(name string, flag int) (*os.File, *PipeWriter, func(), er
|
|||
obj := bkt.Object(name)
|
||||
ctx, cancelFn := context.WithCancel(context.Background())
|
||||
objectWriter := obj.NewWriter(ctx)
|
||||
contentType := mime.TypeByExtension(path.Ext(name))
|
||||
if contentType != "" {
|
||||
objectWriter.ObjectAttrs.ContentType = contentType
|
||||
}
|
||||
if len(fs.config.StorageClass) > 0 {
|
||||
objectWriter.ObjectAttrs.StorageClass = fs.config.StorageClass
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue