]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix double slash (//) killing the gateway 36654/head
authorroot <root@cephdev.cern.ch>
Fri, 26 Jun 2020 10:44:45 +0000 (12:44 +0200)
committerNathan Cutler <ncutler@suse.com>
Sat, 15 Aug 2020 13:10:49 +0000 (15:10 +0200)
When a bucket is inialized as a static website, a curl request on the bucket with double slash kills the gateway.
The problem is on the URL handling of the subdirectory, which tries to remove the last slash of any URL, so when only / is given as a sub-directory, this results to an empty string.

Fixes: https://tracker.ceph.com/issues/41225
Signed-off-by: Theofilos Mouratidis <t.mour@cern.ch>
(cherry picked from commit 626330c504b1af8393986bd0553786c3031422cd)

src/rgw/rgw_rest_s3.cc

index 0de040968c7c85d2ce4f9b2683766aaa21c0a3d4..c053297d357a6b5c77b74857268168505acf50f1 100644 (file)
@@ -4863,7 +4863,7 @@ bool RGWHandler_REST_S3Website::web_dir() const {
 
   if (subdir_name.empty()) {
     return false;
-  } else if (subdir_name.back() == '/') {
+  } else if (subdir_name.back() == '/' && subdir_name.size() > 1) {
     subdir_name.pop_back();
   }