From cae19df058828ad00291a5d4bf98f3f5715ad116 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 27 Jan 2016 17:39:33 +0000 Subject: [PATCH] s3: URL escape CopySource This fixes metadata update and copy for files with `+` in Fixes #315 --- s3/s3.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/s3/s3.go b/s3/s3.go index 48c37d8a6..7134f4027 100644 --- a/s3/s3.go +++ b/s3/s3.go @@ -17,6 +17,7 @@ import ( "errors" "fmt" "io" + "net/url" "path" "regexp" "strings" @@ -523,7 +524,7 @@ func (f *Fs) Copy(src fs.Object, remote string) (fs.Object, error) { } srcFs := srcObj.fs key := f.root + remote - source := srcFs.bucket + "/" + srcFs.root + srcObj.remote + source := url.QueryEscape(srcFs.bucket + "/" + srcFs.root + srcObj.remote) req := s3.CopyObjectInput{ Bucket: &f.bucket, Key: &key, @@ -664,7 +665,7 @@ func (o *Object) SetModTime(modTime time.Time) { ACL: &o.fs.perm, Key: &key, ContentType: &contentType, - CopySource: &sourceKey, + CopySource: aws.String(url.QueryEscape(sourceKey)), Metadata: o.meta, MetadataDirective: &directive, }