summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2012-12-19 10:21:57 -0800
committerYehuda Sadeh <yehuda@inktank.com>2012-12-20 09:45:35 -0800
commit92b59e90590aee501ae090adebf58978912f9dd3 (patch)
tree5a8424c4d93194177849110d28f69d6f51b63cee
parentc02e9062b9736b3fe4365243c74607562bc154e7 (diff)
downloadceph-92b59e90590aee501ae090adebf58978912f9dd3.tar.gz
rgw: don't try to assign content type if not found
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>
-rw-r--r--src/rgw/rgw_rest_swift.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc
index 3a7007b6df8..64614b5f59b 100644
--- a/src/rgw/rgw_rest_swift.cc
+++ b/src/rgw/rgw_rest_swift.cc
@@ -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;
+ }
}
}
}