s3: URL escape CopySource

This fixes metadata update and copy for files with `+` in

Fixes #315
This commit is contained in:
Nick Craig-Wood 2016-01-27 17:39:33 +00:00
parent 8c211fc8df
commit cae19df058
1 changed files with 3 additions and 2 deletions

View File

@ -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,
}