]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: When finding bucket owner info, handle account name being empty 52433/head
authorVedansh Bhartia <vedanshbhartia@gmail.com>
Sun, 16 Jul 2023 04:52:42 +0000 (10:22 +0530)
committerVedansh Bhartia <vedanshbhartia@gmail.com>
Sun, 16 Jul 2023 04:53:55 +0000 (10:23 +0530)
Signed-off-by: Vedansh Bhartia <vedanshbhartia@gmail.com>
src/rgw/rgw_rest_swift.cc

index dc28b77090a38e90f3fca98cdff2898b6e0e46cb..11e7c647c7d916ad7f298032b1853da037445472 100644 (file)
@@ -2081,6 +2081,7 @@ void RGWFormPost::get_owner_info(const req_state* const s,
   const string& bucket_name = s->init_state.url_bucket;
 
   std::unique_ptr<rgw::sal::User> user;
+  std::string bucket_tenant;
 
   /* TempURL in Formpost only requires that bucket name is specified. */
   if (bucket_name.empty()) {
@@ -2108,11 +2109,13 @@ void RGWFormPost::get_owner_info(const req_state* const s,
        throw -EPERM;
       }
     }
+
+    bucket_tenant = user->get_tenant();
   }
 
   /* Need to get user info of bucket owner. */
   std::unique_ptr<rgw::sal::Bucket> bucket;
-  int ret = driver->get_bucket(s, user.get(), user->get_tenant(), bucket_name, &bucket, s->yield);
+  int ret = driver->get_bucket(s, user.get(), bucket_tenant, bucket_name, &bucket, s->yield);
   if (ret < 0) {
     throw ret;
   }