1
mirror of https://github.com/rclone/rclone synced 2024-11-26 04:07:22 +01:00

s3: add --s3-no-system-metadata to suppress read and write of system metadata

See: https://forum.rclone.org/t/problems-with-content-disposition-and-backblaze-b2-using-s3/33292/
This commit is contained in:
Nick Craig-Wood 2022-10-12 08:55:58 +01:00
parent bb3272e837
commit fce22c0065

View File

@ -2164,6 +2164,11 @@ can't check the size and hash but the file contents will be decompressed.
`,
Advanced: true,
Default: false,
}, {
Name: "no_system_metadata",
Help: `Suppress setting and reading of system metadata`,
Advanced: true,
Default: false,
},
}})
}
@ -2290,6 +2295,7 @@ type Options struct {
Versions bool `config:"versions"`
VersionAt fs.Time `config:"version_at"`
Decompress bool `config:"decompress"`
NoSystemMetadata bool `config:"no_system_metadata"`
}
// Fs represents a remote s3 server
@ -5227,6 +5233,10 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
for k, v := range meta {
pv := aws.String(v)
k = strings.ToLower(k)
if o.fs.opt.NoSystemMetadata {
req.Metadata[k] = pv
continue
}
switch k {
case "cache-control":
req.CacheControl = pv
@ -5505,6 +5515,9 @@ func (o *Object) Metadata(ctx context.Context) (metadata fs.Metadata, err error)
// Set system metadata
setMetadata := func(k string, v *string) {
if o.fs.opt.NoSystemMetadata {
return
}
if v == nil || *v == "" {
return
}