Index: chrome/browser/extensions/api/file_handlers/mime_util.cc |
diff --git a/chrome/browser/extensions/api/file_handlers/mime_util.cc b/chrome/browser/extensions/api/file_handlers/mime_util.cc |
index 74b622c26bdf7ec03b792d0d409553995be20d29..e19f74749c8f588ce9438c568e173c6cd1532aa3 100644 |
--- a/chrome/browser/extensions/api/file_handlers/mime_util.cc |
+++ b/chrome/browser/extensions/api/file_handlers/mime_util.cc |
@@ -19,6 +19,12 @@ |
using content::BrowserThread; |
+namespace { |
+ |
+const char kMimeTypeApplicationOctetStream[] = "application/octet-stream"; |
+ |
+} // namespace |
+ |
namespace extensions { |
namespace app_file_handler_util { |
namespace { |
@@ -82,6 +88,15 @@ void OnGetMimeTypeFromMetadataForNonNativeLocalPathCompleted( |
void OnSniffMimeTypeForNativeLocalPathCompleted( |
scoped_ptr<std::string> mime_type, |
const base::Callback<void(const std::string&)>& callback) { |
+ // Do not return application/zip as sniffed result. If the file has .zip |
+ // extension, it should be already returned as application/zip. If the file |
+ // does not have .zip extension and couldn't find mime type from the |
+ // extension, it might be unknown internally zipped file. |
+ if (*mime_type == "application/zip") { |
+ callback.Run(kMimeTypeApplicationOctetStream); |
+ return; |
+ } |
+ |
callback.Run(*mime_type); |
} |
@@ -99,7 +114,8 @@ void OnGetMimeTypeFromFileForNativeLocalPathCompleted( |
return; |
} |
- scoped_ptr<std::string> sniffed_mime_type(new std::string); |
+ scoped_ptr<std::string> sniffed_mime_type( |
+ new std::string(kMimeTypeApplicationOctetStream)); |
std::string* const sniffed_mime_type_ptr = sniffed_mime_type.get(); |
BrowserThread::PostBlockingPoolTaskAndReply( |
FROM_HERE, |