]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWDeleteMultiObj adds error messages 57641/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 22 May 2024 20:54:13 +0000 (16:54 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 31 May 2024 15:49:55 +0000 (11:49 -0400)
and consistently returns ERR_MALFORMED_XML for xml errors

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_op.cc

index 95e382435bc461f34f1b7df8ebb17d1f10ec91c9..c2a8d05bb061af91bac9bbcc1b6225f89f67663e 100644 (file)
@@ -12,6 +12,7 @@
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/optional.hpp>
 #include <boost/utility/in_place_factory.hpp>
+#include <fmt/format.h>
 
 #include "include/scope_guard.h"
 #include "common/Clock.h"
@@ -6788,13 +6789,15 @@ void RGWDeleteMultiObj::execute(optional_yield y)
   }
 
   if (!parser.parse(buf, data.length(), 1)) {
-    op_ret = -EINVAL;
+    s->err.message = "Failed to parse xml input";
+    op_ret = -ERR_MALFORMED_XML;
     return;
   }
 
   auto multi_delete = static_cast<RGWMultiDelDelete *>(parser.find_first("Delete"));
   if (!multi_delete) {
-    op_ret = -EINVAL;
+    s->err.message = "Missing require element Delete";
+    op_ret = -ERR_MALFORMED_XML;
     return;
   }
 
@@ -6805,6 +6808,7 @@ void RGWDeleteMultiObj::execute(optional_yield y)
   }
   const int multi_delete_object_num = multi_delete->objects.size();
   if (multi_delete_object_num > max_num) {
+    s->err.message = fmt::format("Object count limit {} exceeded", max_num);
     op_ret = -ERR_MALFORMED_XML;
     return;
   }