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/11/04 02:30:33 UTC
svn commit: r1405476 -
/incubator/mesos/branches/0.10.0/third_party/libprocess/src/process.cpp
Author: benh
Date: Sun Nov 4 01:30:33 2012
New Revision: 1405476
URL: http://svn.apache.org/viewvc?rev=1405476&view=rev
Log:
Fixed bug in detecting the extension of an asset.
Modified:
incubator/mesos/branches/0.10.0/third_party/libprocess/src/process.cpp
Modified: incubator/mesos/branches/0.10.0/third_party/libprocess/src/process.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/branches/0.10.0/third_party/libprocess/src/process.cpp?rev=1405476&r1=1405475&r2=1405476&view=diff
==============================================================================
--- incubator/mesos/branches/0.10.0/third_party/libprocess/src/process.cpp (original)
+++ incubator/mesos/branches/0.10.0/third_party/libprocess/src/process.cpp Sun Nov 4 01:30:33 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];
+ }
}
}