diff options
author | David Rothstein <drothstein@gmail.com> | 2014-09-01 22:08:43 -0400 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2014-09-01 22:08:43 -0400 |
commit | 99c124d4d4c86d2cd2a9dc65d71632bc0dd98c1a (patch) | |
tree | 82200aff48ec21104fc89fb724fb30360b3cccac /includes/file.inc | |
parent | 29a0dc349bf1ec8251cccc4e561eabcaccde038b (diff) | |
download | brdo-99c124d4d4c86d2cd2a9dc65d71632bc0dd98c1a.tar.gz brdo-99c124d4d4c86d2cd2a9dc65d71632bc0dd98c1a.tar.bz2 |
Issue #1468210 by marthinal, quicksketch, tstoeckler, Devin Carlson, David_Rothstein, Eric_A: Fixed Remove special $user->uid == 1 check in file_validate_size().
Diffstat (limited to 'includes/file.inc')
-rw-r--r-- | includes/file.inc | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/includes/file.inc b/includes/file.inc index d3008cc4f..fb2685659 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -1729,8 +1729,6 @@ function file_validate_extensions(stdClass $file, $extensions) { /** * Checks that the file's size is below certain limits. * - * This check is not enforced for the user #1. - * * @param $file * A Drupal file object. * @param $file_limit @@ -1748,20 +1746,17 @@ function file_validate_extensions(stdClass $file, $extensions) { */ function file_validate_size(stdClass $file, $file_limit = 0, $user_limit = 0) { global $user; - $errors = array(); - // Bypass validation for uid = 1. - if ($user->uid != 1) { - if ($file_limit && $file->filesize > $file_limit) { - $errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit))); - } + if ($file_limit && $file->filesize > $file_limit) { + $errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit))); + } - // Save a query by only calling file_space_used() when a limit is provided. - if ($user_limit && (file_space_used($user->uid) + $file->filesize) > $user_limit) { - $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize), '%quota' => format_size($user_limit))); - } + // Save a query by only calling file_space_used() when a limit is provided. + if ($user_limit && (file_space_used($user->uid) + $file->filesize) > $user_limit) { + $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize), '%quota' => format_size($user_limit))); } + return $errors; } |