Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: chrome/browser/extensions/api/file_handlers/mime_util.cc

Issue 1073003003: Do not handle a file as application/zip when the extension is not .zip. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to OnSniffMimeTypeForNativeLocalPathCompleted. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..525df80241a24fd197895045f9db7671dbee44e8 100644
--- a/chrome/browser/extensions/api/file_handlers/mime_util.cc
+++ b/chrome/browser/extensions/api/file_handlers/mime_util.cc
@@ -82,6 +82,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("application/octet-stream");
+ return;
+ }
+
callback.Run(*mime_type);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698