mirror of
https://github.com/rclone/rclone.git
synced 2024-11-23 05:33:11 +08:00
s3: Fix corrupting Content-Type on mod time update
This fixes an issue where updating the modification time resets the content-type to the S3 default of binary/octet-stream which breaks static websites that expect an html file to have a content-type of text/html.
This commit is contained in:
parent
6a64567dd7
commit
fe0289f2f5
4
s3/s3.go
4
s3/s3.go
|
@ -644,6 +644,9 @@ func (o *Object) SetModTime(modTime time.Time) {
|
|||
}
|
||||
o.meta[metaMtime] = aws.String(swift.TimeToFloatString(modTime))
|
||||
|
||||
// Guess the content type
|
||||
contentType := fs.MimeType(o)
|
||||
|
||||
// Copy the object to itself to update the metadata
|
||||
key := o.fs.root + o.remote
|
||||
sourceKey := o.fs.bucket + "/" + key
|
||||
|
@ -652,6 +655,7 @@ func (o *Object) SetModTime(modTime time.Time) {
|
|||
Bucket: &o.fs.bucket,
|
||||
ACL: &o.fs.perm,
|
||||
Key: &key,
|
||||
ContentType: &contentType,
|
||||
CopySource: &sourceKey,
|
||||
Metadata: o.meta,
|
||||
MetadataDirective: &directive,
|
||||
|
|
Loading…
Reference in New Issue
Block a user