From: root Date: Fri, 26 Jun 2020 10:44:45 +0000 (+0200) Subject: rgw: fix double slash (//) killing the gateway X-Git-Tag: v15.2.5~44^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a7f677fc8392a6ddcad14b41837d89a394e08a10;p=ceph.git rgw: fix double slash (//) killing the gateway 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 (cherry picked from commit 626330c504b1af8393986bd0553786c3031422cd) --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 0de040968c7c..c053297d357a 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -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(); }