|
|
@ -33,11 +33,13 @@ func (s3a *S3ApiServer) CopyObjectHandler(w http.ResponseWriter, r *http.Request |
|
|
|
entry, err := s3a.getEntry(dir, name) |
|
|
|
if err != nil { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrInvalidCopySource, r) |
|
|
|
return |
|
|
|
} |
|
|
|
entry.Extended = weed_server.SaveAmzMetaData(r, entry.Extended, isReplace(r)) |
|
|
|
err = s3a.touch(dir, name, entry) |
|
|
|
if err != nil { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrInvalidCopySource, r) |
|
|
|
return |
|
|
|
} |
|
|
|
writeSuccessResponseXML(w, CopyObjectResult{ |
|
|
|
ETag: fmt.Sprintf("%x", entry.Attributes.Md5), |
|
|
@ -51,6 +53,13 @@ func (s3a *S3ApiServer) CopyObjectHandler(w http.ResponseWriter, r *http.Request |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrInvalidCopySource, r) |
|
|
|
return |
|
|
|
} |
|
|
|
srcPath := util.FullPath(fmt.Sprintf("%s/%s%s", s3a.option.BucketsPath, srcObject, srcObject)) |
|
|
|
dir, name := srcPath.DirAndName() |
|
|
|
_, err = s3a.getEntry(dir, name) |
|
|
|
if err != nil { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrInvalidCopySource, r) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if srcBucket == dstBucket && srcObject == dstObject { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrInvalidCopyDest, r) |
|
|
|