Skip to content

Commit

Permalink
Integrity Check: Add Substring Match to ExcludeFileByNameFilterIterat…
Browse files Browse the repository at this point in the history
…or.php

Fixes owncloud#24218
  • Loading branch information
kaindl committed Aug 11, 2016
1 parent d2e2021 commit 1395652
Showing 1 changed file with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,26 @@ class ExcludeFileByNameFilterIterator extends \RecursiveFilterIterator {
/**
* Array of excluded file names. Those are not scanned by the integrity checker.
* This is used to exclude files which administrators could upload by mistakes
* such as .DS_Store files.
* such as .DS_Store files. These file names are matched exactly.
*
* @var array
*/
private $excludedFilenames = [
'.DS_Store', // Mac OS X
'Thumbs.db', // Microsoft Windows
'.directory', // Dolphin (KDE)
'.webapp', // Gentoo/Funtoo & derivatives use a tool known as webapp-config to manager wep-apps.
'.webapp', // Gentoo/Funtoo & derivatives use a tool known as webapp-config to manage wep-apps.
];
/**
* Array of excluded file names. Those are not scanned by the integrity checker.
* This is used to exclude files which administrators could upload by mistakes
* such as .DS_Store files. These strings are submatched, so any file names
* containing these strings, are ignored.
*
* @var array
*/
private $excludedFilenamesSubMatch = [
'.webapp-owncloud-', // Gentoo/Funtoo & derivatives use a tool known as webapp-config to manage wep-apps.
];

/**
Expand All @@ -51,10 +62,19 @@ public function accept() {
return true;
}

return !in_array(
if (in_array(
$this->current()->getFilename(),
$this->excludedFilenames,
true
);
)) {
return false;
}

foreach ($this->excludedFilenamesSubMatch as $excludedFilename)
if (strpos($this->current()->getFilename(),$excludedFilename) !== false) {
return false;
}

return true;
}
}

0 comments on commit 1395652

Please sign in to comment.