Problem/Motivation
Currently, the maximum file size limits are not respected in the right way. The ManagedFileTest illustrates this in a clear way: WebformElementManagedFile's maxFilesize is always at least 2 MB, even when setting it much lower (for example, 80 KB).
In this issue, it's also planned to handle the edge case when there's no max file size configured. Currently, the module returns null for the maxFilesize field. It should return the default PHP/Drupal max file size limit.
Proposed resolution
- adapt
$registry->addFieldResolver('WebformElementManagedFileBase', 'maxFilesize'', $callback)field resolver - Write a new test for the edge case when no file size limit is set
API changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | fix-querying-for-maxfilesize-of-uploaded-files.patch | 5.38 KB | hazn |
Issue fork graphql_webform-3478477
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
hazn commentedpatch from the mr
Comment #4
hazn commentedComment #5
pfrenssenThanks for starting this and adding a test! I reviewed the code and left a comment on the MR. Let's follow the same logic as used in the Webform module.
Comment #6
pfrenssenThe Webform module also has a limit on the upload size across all files in a form. This is controlled with the
form_file_limitlimit in the webform, and the global settingsettings.default_form_file_limit.This is not in scope of this issue but it would be great if we can adhere to this as well. I created a feature request for this: #3482192: Respect the per-form file limit.
Comment #7
pfrenssenCreated a bug report in the Webform module about the PHP limit being ignored under certain circumstances: #3482402: Upload filesize limit doesn't properly account for PHP max upload setting.
Comment #9
pfrenssen