summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_website.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/rgw/rgw_website.cc')
-rw-r--r--src/rgw/rgw_website.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rgw/rgw_website.cc b/src/rgw/rgw_website.cc
index 4369ac752dc..ff58786c77d 100644
--- a/src/rgw/rgw_website.cc
+++ b/src/rgw/rgw_website.cc
@@ -45,7 +45,9 @@ void RGWBWRoutingRule::apply_rule(const string& default_protocol, const string&
if (!redirect_info.replace_key_prefix_with.empty()) {
*new_url += redirect_info.replace_key_prefix_with;
- *new_url += key.substr(condition.key_prefix_equals.size());
+ if (key.size() > condition.key_prefix_equals.size()) {
+ *new_url += key.substr(condition.key_prefix_equals.size());
+ }
} else if (!redirect_info.replace_key_with.empty()) {
*new_url += redirect_info.replace_key_with;
} else {