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

Unified Diff: ui/file_manager/file_manager/foreground/js/directory_contents.js

Issue 528263002: Hide .crdownload files and prevent users from changing extension to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Precompile regular expression. Created 6 years, 3 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
Index: ui/file_manager/file_manager/foreground/js/directory_contents.js
diff --git a/ui/file_manager/file_manager/foreground/js/directory_contents.js b/ui/file_manager/file_manager/foreground/js/directory_contents.js
index a436f9459183a4433c33e781e10cc34c684f80c9..ca3f2e69e6c66d71bb7d89627ac4e256358f634e 100644
--- a/ui/file_manager/file_manager/foreground/js/directory_contents.js
+++ b/ui/file_manager/file_manager/foreground/js/directory_contents.js
@@ -319,7 +319,8 @@ DriveMetadataSearchContentScanner.prototype.scan = function(
* When filters are changed, a 'changed' event is fired.
*
* @param {MetadataCache} metadataCache Metadata cache service.
- * @param {boolean} showHidden If files starting with '.' are shown.
+ * @param {boolean} showHidden If files starting with '.' or ending with
+ * '.crdownlaod' are shown.
* @constructor
* @extends {cr.EventTarget}
*/
@@ -371,10 +372,14 @@ FileFilter.prototype.removeFilter = function(name) {
* @param {boolean} value If do not show hidden files.
*/
FileFilter.prototype.setFilterHidden = function(value) {
+ var regexpCrdownloadExtension = /\.crdownload$/i;
if (value) {
this.addFilter(
'hidden',
- function(entry) { return entry.name.substr(0, 1) !== '.'; }
+ function(entry) {
+ return entry.name.substr(0, 1) !== '.' &&
+ !regexpCrdownloadExtension.test(entry.name);
+ }
);
} else {
this.removeFilter('hidden');
« no previous file with comments | « ui/file_manager/file_manager/common/js/util.js ('k') | ui/file_manager/file_manager/foreground/js/file_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698