Skip to content

Commit

Permalink
Fix contenttype (#151)
Browse files Browse the repository at this point in the history
Need to initialize the writer before setting the content type
  • Loading branch information
phbnf authored Aug 19, 2024
1 parent a419214 commit e249134
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion storage/gcp/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -669,13 +669,13 @@ func (s *gcsStorage) setObject(ctx context.Context, objName string, data []byte,
obj := bkt.Object(objName)

var w *gcs.Writer
w.ObjectAttrs.ContentType = contType
if cond == nil {
w = obj.NewWriter(ctx)

} else {
w = obj.If(*cond).NewWriter(ctx)
}
w.ObjectAttrs.ContentType = contType
if _, err := w.Write(data); err != nil {
return fmt.Errorf("failed to write object %q to bucket %q: %w", objName, s.bucket, err)
}
Expand Down

0 comments on commit e249134

Please sign in to comment.