feat(s3): set content type from stream when uploading (#4460)
Co-authored-by: guopeilun <guopl@flatincbr.com>
This commit is contained in:
parent
645c10c11f
commit
6b97b4eb20
@ -136,11 +136,13 @@ func (d *S3) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreame
|
|||||||
uploader.PartSize = stream.GetSize() / (s3manager.MaxUploadParts - 1)
|
uploader.PartSize = stream.GetSize() / (s3manager.MaxUploadParts - 1)
|
||||||
}
|
}
|
||||||
key := getKey(stdpath.Join(dstDir.GetPath(), stream.GetName()), false)
|
key := getKey(stdpath.Join(dstDir.GetPath(), stream.GetName()), false)
|
||||||
|
contentType := stream.GetMimetype()
|
||||||
log.Debugln("key:", key)
|
log.Debugln("key:", key)
|
||||||
input := &s3manager.UploadInput{
|
input := &s3manager.UploadInput{
|
||||||
Bucket: &d.Bucket,
|
Bucket: &d.Bucket,
|
||||||
Key: &key,
|
Key: &key,
|
||||||
Body: stream,
|
Body: stream,
|
||||||
|
ContentType: &contentType,
|
||||||
}
|
}
|
||||||
_, err := uploader.UploadWithContext(ctx, input)
|
_, err := uploader.UploadWithContext(ctx, input)
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user