]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: change json formatting for swift list container
authorYehuda Sadeh <yehuda@inktank.com>
Fri, 8 Feb 2013 21:14:49 +0000 (13:14 -0800)
committerSage Weil <sage@inktank.com>
Wed, 13 Feb 2013 16:47:03 +0000 (08:47 -0800)
Fixes: #4048
There is some difference in the way swift formats the
xml output and the json output for list container. In
xml the entity is named 'name' and in json it is named
'subdir'.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 3e4d79fe42dfc3ca70dc4d5d2aff5223f62eb34b)

src/rgw/rgw_rest_swift.cc

index 64614b5f59baf9aa7788a6a3a0c3aab2e12e4ab5..34a73633f9ae284a5dade25c42ef075ffd9b7194 100644 (file)
@@ -158,9 +158,17 @@ void RGWListBucket_ObjStore_SWIFT::send_response()
       if (name.compare(delimiter) == 0)
         goto next;
 
-      s->formatter->open_object_section("object");
-      s->formatter->dump_string("name", pref_iter->first);
-      s->formatter->close_section();
+        s->formatter->open_object_section("subdir");
+
+        /* swift is a bit inconsistent here */
+        switch (s->format) {
+          case RGW_FORMAT_XML:
+            s->formatter->dump_string("name", pref_iter->first);
+            break;
+          default:
+            s->formatter->dump_string("subdir", pref_iter->first);
+        }
+        s->formatter->close_section();
     }
 next:
     if (do_objs)