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

Unified Diff: chrome/browser/download/download_extension_api.cc

Issue 10103004: Disallow slashes in filename in downloads.download() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 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 | chrome/test/data/extensions/api_test/downloads/test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_extension_api.cc
diff --git a/chrome/browser/download/download_extension_api.cc b/chrome/browser/download/download_extension_api.cc
index 48006b83ce1ae96bdbcd98f17722a4bffec249a1..cdf0193ff2ef33882e4c8323ea762f597ede8def 100644
--- a/chrome/browser/download/download_extension_api.cc
+++ b/chrome/browser/download/download_extension_api.cc
@@ -172,12 +172,11 @@ DownloadItem::DownloadState StateEnumFromString(const std::string& state) {
bool ValidateFilename(const string16& filename) {
// TODO(benjhayden): More robust validation of filename.
- if (filename.size() >= 2u && filename[0] == L'.' && filename[1] == L'.')
+ if ((filename.find('/') != string16::npos) ||
+ (filename.find('\\') != string16::npos))
return false;
-
- if (filename.size() >= 1u && filename[0] == L'/')
+ if (filename.size() >= 2u && filename[0] == L'.' && filename[1] == L'.')
return false;
-
return true;
}
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/downloads/test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698