mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
s3: copy object API needs to escape special characters
fix https://github.com/chrislusf/seaweedfs/issues/2482
This commit is contained in:
parent
9b0da7cd7d
commit
5c3b783310
|
@ -142,7 +142,7 @@ func (s3a *S3ApiServer) completeMultipartUpload(input *s3.CompleteMultipartUploa
|
||||||
|
|
||||||
output = &CompleteMultipartUploadResult{
|
output = &CompleteMultipartUploadResult{
|
||||||
CompleteMultipartUploadOutput: s3.CompleteMultipartUploadOutput{
|
CompleteMultipartUploadOutput: s3.CompleteMultipartUploadOutput{
|
||||||
Location: aws.String(fmt.Sprintf("http://%s%s/%s", s3a.option.Filer.ToHttpAddress(), dirName, entryName)),
|
Location: aws.String(fmt.Sprintf("http://%s%s/%s", s3a.option.Filer.ToHttpAddress(), urlPathEscape(dirName), urlPathEscape(entryName))),
|
||||||
Bucket: input.Bucket,
|
Bucket: input.Bucket,
|
||||||
ETag: aws.String("\"" + filer.ETagChunks(finalParts) + "\""),
|
ETag: aws.String("\"" + filer.ETagChunks(finalParts) + "\""),
|
||||||
Key: objectKey(input.Key),
|
Key: objectKey(input.Key),
|
||||||
|
|
|
@ -69,9 +69,9 @@ func (s3a *S3ApiServer) CopyObjectHandler(w http.ResponseWriter, r *http.Request
|
||||||
}
|
}
|
||||||
|
|
||||||
dstUrl := fmt.Sprintf("http://%s%s/%s%s?collection=%s",
|
dstUrl := fmt.Sprintf("http://%s%s/%s%s?collection=%s",
|
||||||
s3a.option.Filer.ToHttpAddress(), s3a.option.BucketsPath, dstBucket, dstObject, dstBucket)
|
s3a.option.Filer.ToHttpAddress(), s3a.option.BucketsPath, dstBucket, urlPathEscape(dstObject), dstBucket)
|
||||||
srcUrl := fmt.Sprintf("http://%s%s/%s%s",
|
srcUrl := fmt.Sprintf("http://%s%s/%s%s",
|
||||||
s3a.option.Filer.ToHttpAddress(), s3a.option.BucketsPath, srcBucket, srcObject)
|
s3a.option.Filer.ToHttpAddress(), s3a.option.BucketsPath, srcBucket, urlPathEscape(srcObject))
|
||||||
|
|
||||||
_, _, resp, err := util.DownloadFile(srcUrl, "")
|
_, _, resp, err := util.DownloadFile(srcUrl, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -154,7 +154,7 @@ func (s3a *S3ApiServer) CopyObjectPartHandler(w http.ResponseWriter, r *http.Req
|
||||||
dstUrl := fmt.Sprintf("http://%s%s/%s/%04d.part?collection=%s",
|
dstUrl := fmt.Sprintf("http://%s%s/%s/%04d.part?collection=%s",
|
||||||
s3a.option.Filer.ToHttpAddress(), s3a.genUploadsFolder(dstBucket), uploadID, partID, dstBucket)
|
s3a.option.Filer.ToHttpAddress(), s3a.genUploadsFolder(dstBucket), uploadID, partID, dstBucket)
|
||||||
srcUrl := fmt.Sprintf("http://%s%s/%s%s",
|
srcUrl := fmt.Sprintf("http://%s%s/%s%s",
|
||||||
s3a.option.Filer.ToHttpAddress(), s3a.option.BucketsPath, srcBucket, srcObject)
|
s3a.option.Filer.ToHttpAddress(), s3a.option.BucketsPath, srcBucket, urlPathEscape(srcObject))
|
||||||
|
|
||||||
dataReader, err := util.ReadUrlAsReaderCloser(srcUrl, rangeHeader)
|
dataReader, err := util.ReadUrlAsReaderCloser(srcUrl, rangeHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue