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

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: 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..44198112627cb1180427c8150d86d8414de3fb08 100644
--- a/chrome/browser/extensions/api/file_handlers/mime_util.cc
+++ b/chrome/browser/extensions/api/file_handlers/mime_util.cc
@@ -37,6 +37,12 @@ void SniffMimeType(const base::FilePath& local_path, std::string* result) {
net::FilePathToFileURL(local_path),
std::string(), // type_hint (passes no hint)
result);
+
+ // If the extension is not .zip, do not handle the file as application/zip
+ // since it might be unknown internally zipped file.
+ if (*result == "application/zip" &&
+ local_path.Extension() != FILE_PATH_LITERAL(".zip"))
benwells 2015/04/14 21:57:22 The logic of this flow is, I think: - return the m
yawano 2015/04/15 03:41:34 Moving to OnSniffMimeTypeForNativeLocalPathComplet
+ result->assign("application/octet-stream");
benwells 2015/04/14 21:57:22 Why is the default application/octet-stream? Is th
yawano 2015/04/15 03:41:34 I think there is no default mime type. The default
}
}
« 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