diff --git a/core/includes/file.inc b/core/includes/file.inc index 0e69bfe..2bcaac3 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -1712,20 +1720,15 @@ function file_validate_extensions(stdClass $file, $extensions) { * @see hook_file_validate() */ 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; }