]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't try to assign content type if not found
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 19 Dec 2012 18:21:57 +0000 (10:21 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Thu, 20 Dec 2012 17:45:35 +0000 (09:45 -0800)
Fixes: #3648
Cannot assign a NULL pointer into stl string. This is only
relevant to swift, when uploading an object without specifying
content type, and when the suffix cannot be determined.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_rest_swift.cc

index 3a7007b6df8b26d043769db243a8f53b7f0a15a7..64614b5f59baf9aa7788a6a3a0c3aab2e12e4ab5 100644 (file)
@@ -304,7 +304,10 @@ int RGWPutObj_ObjStore_SWIFT::get_params()
       suffix++;
       if (*suffix) {
         string suffix_str(suffix);
-        s->generic_attrs[RGW_ATTR_CONTENT_TYPE] = rgw_find_mime_by_ext(suffix_str);
+       const char *mime = rgw_find_mime_by_ext(suffix_str);
+       if (mime) {
+          s->generic_attrs[RGW_ATTR_CONTENT_TYPE] = mime;
+       }
       }
     }
   }