]> 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)
committerYehuda Sadeh <yehuda@inktank.com>
Sat, 9 Feb 2013 21:35:52 +0000 (13:35 -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>
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)