From 0b63ef8ef3b801e71ea09965a0ee8d172de4f31c Mon Sep 17 00:00:00 2001 From: mkogan1 Date: Thu, 18 Apr 2019 05:30:51 -0400 Subject: [PATCH] rgw: fix default_placement containing "/" when storage_class is standard fixes: http://tracker.ceph.com/issues/39380 Signed-off-by: mkogan1 --- src/rgw/rgw_common.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 0597cba413e3..51cd22faf831 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -695,7 +695,7 @@ struct rgw_placement_rule { void encode(bufferlist& bl) const { /* no ENCODE_START/END due to backward compatibility */ - std::string s = to_str_explicit(); + std::string s = to_str(); ceph::encode(s, bl); } @@ -720,12 +720,11 @@ struct rgw_placement_rule { size_t pos = s.find("/"); if (pos == std::string::npos) { name = s; + storage_class.clear(); return; } name = s.substr(0, pos); - if (pos < s.size() - 1) { - storage_class = s.substr(pos + 1); - } + storage_class = s.substr(pos + 1); } bool standard_storage_class() const { -- 2.47.3