URL Encode X-Amz-Copy-Source as per the spec (#2114)

The documents for COPY state that the X-Amz-Copy-Source must be URL encoded.

http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html
This commit is contained in:
Nick Craig-Wood
2016-07-06 22:00:29 +01:00
committed by Harshavardhana
parent a51bb1d728
commit 8c767218a4
3 changed files with 9 additions and 5 deletions

View File

@@ -27,6 +27,7 @@ import (
"io/ioutil"
"math/rand"
"net/http"
"net/url"
"sync"
"time"
@@ -689,7 +690,7 @@ func (s *TestSuiteCommon) TestCopyObject(c *C) {
request, err = newTestRequest("PUT", getPutObjectURL(s.endPoint, bucketName, objectName2),
0, nil, s.accessKey, s.secretKey)
// setting the "X-Amz-Copy-Source" to allow copying the content of previously uploaded object.
request.Header.Set("X-Amz-Copy-Source", "/"+bucketName+"/"+objectName)
request.Header.Set("X-Amz-Copy-Source", url.QueryEscape("/"+bucketName+"/"+objectName))
c.Assert(err, IsNil)
// execute the HTTP request.
// the content is expected to have the content of previous disk.