From 19a191e5ccbcd10bd0227fb0fc9e3ba60c62e7b8 Mon Sep 17 00:00:00 2001 From: dwj192 Date: Wed, 9 Sep 2015 10:12:57 +0800 Subject: [PATCH] objects can not be displayed which object name does not contain '.' when get the bucket index. Fixes: #12963 Signed-off-by: Weijun Duan --- src/rgw/rgw_bucket.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index cfa5e204a44d..b857a5fd08ff 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -715,16 +715,19 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state, string oid = key.name; int pos = oid.find_last_of('.'); - if (pos < 0) - continue; - - string name = oid.substr(0, pos); - string suffix = oid.substr(pos + 1); - - if (suffix.compare("meta") == 0) { - meta_objs[name] = true; + if (pos < 0) { + /* obj has no suffix */ + all_objs[key] = oid; } else { - all_objs[key] = name; + /* obj has suffix */ + string name = oid.substr(0, pos); + string suffix = oid.substr(pos + 1); + + if (suffix.compare("meta") == 0) { + meta_objs[name] = true; + } else { + all_objs[key] = name; + } } } -- 2.47.3