From c87b8f4c302d225cce45cdfc312c35ddbf7c8f86 Mon Sep 17 00:00:00 2001 From: chrislu Date: Mon, 17 Jan 2022 23:09:37 -0800 Subject: [PATCH] S3: fail fast when "X-Amz-Copy-Source" is a folder fix https://github.com/chrislusf/seaweedfs/issues/2593 --- weed/s3api/s3api_object_copy_handlers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/weed/s3api/s3api_object_copy_handlers.go b/weed/s3api/s3api_object_copy_handlers.go index 8af0cacf1..5c082eeda 100644 --- a/weed/s3api/s3api_object_copy_handlers.go +++ b/weed/s3api/s3api_object_copy_handlers.go @@ -38,6 +38,10 @@ func (s3a *S3ApiServer) CopyObjectHandler(w http.ResponseWriter, r *http.Request s3err.WriteErrorResponse(w, r, s3err.ErrInvalidCopySource) return } + if entry.IsDirectory { + s3err.WriteErrorResponse(w, r, s3err.ErrInvalidCopySource) + return + } entry.Extended = weed_server.SaveAmzMetaData(r, entry.Extended, isReplace(r)) err = s3a.touch(dir, name, entry) if err != nil {