Skip to content

Commit

Permalink
#7496 Don`t allow upload of files with extension .part
Browse files Browse the repository at this point in the history
  • Loading branch information
IljaN authored and Vincent Petry committed Mar 24, 2017
1 parent 745a12e commit 4c2358c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/private/legacy/util.php
Expand Up @@ -1438,6 +1438,12 @@ public static function isValidFileName($file) {
if (\OC\Files\Filesystem::isIgnoredDir($trimmed)) {
return false;
}

$path_parts = pathinfo($trimmed);
if ($path_parts['extension'] === 'part') {
return false;
}

foreach (str_split($trimmed) as $char) {
if (strpos(\OCP\Constants::FILENAME_INVALID_CHARS, $char) !== false) {
return false;
Expand Down

0 comments on commit 4c2358c

Please sign in to comment.