Repository navigation
Conversation
Replace the hardcoded 20 MB limit with OCP\Util::uploadLimit(), the smaller of upload_max_filesize and post_max_size, and include the limit in the "File is too big" error. Requests over post_max_size, which PHP drops entirely, now get the same error instead of "Invalid file provided". Fixes nextcloud#6175 Assisted-By: Claude Opus 5.5 Signed-off-by: Anton Josefsson <antonjosefsson@hotmail.se>
s0undy
force-pushed
the
fix/template-upload-size-from-php-limits
branch
from
October 28, 2026 21:26
976e4f0 to
908b6ec
Compare
Author
|
Think you can have a quick look? @juliusknorr |
elzody
reviewed
Nov 3, 2026
|
|
||
| if (is_uploaded_file($files['tmp_name']) && !Filesystem::isFileBlacklisted($files['tmp_name'])) { | ||
| if ($files['size'] > $this->maxSize) { | ||
| if ($files['size'] > Util::uploadLimit()) { |
Collaborator
There was a problem hiding this comment.
Wouldn't it already be rejected here by PHP, making this check redundant?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6175
Summary
Replaces the hardcoded 20 MB template limit with the smaller of upload_max_filesize and post_max_size. The "File is too big" error now includes that limit, e.g. "File is too big. The maximum upload size is 10 MB". Requests over post_max_size, which PHP drops entirely, now show the same error instead of "Invalid file provided".
Checklist