mirror of
https://github.com/rclone/rclone.git
synced 2024-11-23 15:09:54 +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))
|
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
|
// Copy the object to itself to update the metadata
|
||||||
key := o.fs.root + o.remote
|
key := o.fs.root + o.remote
|
||||||
sourceKey := o.fs.bucket + "/" + key
|
sourceKey := o.fs.bucket + "/" + key
|
||||||
|
@ -652,6 +655,7 @@ func (o *Object) SetModTime(modTime time.Time) {
|
||||||
Bucket: &o.fs.bucket,
|
Bucket: &o.fs.bucket,
|
||||||
ACL: &o.fs.perm,
|
ACL: &o.fs.perm,
|
||||||
Key: &key,
|
Key: &key,
|
||||||
|
ContentType: &contentType,
|
||||||
CopySource: &sourceKey,
|
CopySource: &sourceKey,
|
||||||
Metadata: o.meta,
|
Metadata: o.meta,
|
||||||
MetadataDirective: &directive,
|
MetadataDirective: &directive,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user