You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/12/11 01:01:25 UTC

svn commit: r1419921 - /incubator/mesos/branches/0.10.x/third_party/libprocess/src/process.cpp

Author: benh
Date: Tue Dec 11 00:01:24 2012
New Revision: 1419921

URL: http://svn.apache.org/viewvc?rev=1419921&view=rev
Log:
Fixed bug in detecting the extension of an asset.

Modified:
    incubator/mesos/branches/0.10.x/third_party/libprocess/src/process.cpp

Modified: incubator/mesos/branches/0.10.x/third_party/libprocess/src/process.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/branches/0.10.x/third_party/libprocess/src/process.cpp?rev=1419921&r1=1419920&r2=1419921&view=diff
==============================================================================
--- incubator/mesos/branches/0.10.x/third_party/libprocess/src/process.cpp (original)
+++ incubator/mesos/branches/0.10.x/third_party/libprocess/src/process.cpp Tue Dec 11 00:01:24 2012
@@ -2811,13 +2811,15 @@ void ProcessBase::visit(const HttpEvent&
       response.path += "/" + tokens[i];
     }
 
-    // Try and determine the Content-Type.
-    size_t index = response.path.find_last_of('.');
-
-    if (index != string::npos) {
-      string extension = response.path.substr(index);
-      if (assets[name].types.count(extension) > 0) {
-        response.headers["Content-Type"] = assets[name].types[extension];
+    // Try and determine the Content-Type from an extension.
+    Try<string> basename = os::basename(response.path);
+    if (!basename.isError()) {
+      size_t index = basename.get().find_last_of('.');
+      if (index != string::npos) {
+        string extension = basename.get().substr(index);
+        if (assets[name].types.count(extension) > 0) {
+          response.headers["Content-Type"] = assets[name].types[extension];
+        }
       }
     }