From fce22c00656b8c62081d76c9854a95ee25ef827b Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 12 Oct 2022 08:55:58 +0100 Subject: [PATCH] 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/ --- backend/s3/s3.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 84da84e91..c0fc888fc 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -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 }