Skip to content

Commit

Permalink
feat(s3): set content type from stream when uploading (#4460)
Browse files Browse the repository at this point in the history
Co-authored-by: guopeilun <guopl@flatincbr.com>
  • Loading branch information
plzzzzg and guopeilun authored May 24, 2023
1 parent 645c10c commit 6b97b4e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/s3/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ func (d *S3) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreame
uploader.PartSize = stream.GetSize() / (s3manager.MaxUploadParts - 1)
}
key := getKey(stdpath.Join(dstDir.GetPath(), stream.GetName()), false)
contentType := stream.GetMimetype()
log.Debugln("key:", key)
input := &s3manager.UploadInput{
Bucket: &d.Bucket,
Key: &key,
Body: stream,
Bucket: &d.Bucket,
Key: &key,
Body: stream,
ContentType: &contentType,
}
_, err := uploader.UploadWithContext(ctx, input)
return err
Expand Down

0 comments on commit 6b97b4e

Please sign in to comment.