Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support indexed keys of file uploads in file upload normalizer #229

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

aschempp
Copy link
Collaborator

@aschempp aschempp commented Dec 9, 2024

Since Contao does not have a built-in support for "multiple file uploads", our terminal42/contao-fineuploader has added a handler in Contao 5 to convert an array of uploads to separate upload fields. So if you have an input field attachements with fineuploader, you would get an attachements_0, attachements_1 etc. property in $files of Contao's processFormData hook.

This PR normalizes this back to the expected format of normalized files (attachements => [0 => ..., 1 => ...]).

@aschempp aschempp added the bug label Dec 9, 2024
@aschempp aschempp requested a review from Toflar December 9, 2024 13:03
Copy link
Collaborator

@Toflar Toflar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs tests.

@aschempp aschempp requested a review from Toflar December 9, 2024 13:21
@aschempp
Copy link
Collaborator Author

aschempp commented Dec 9, 2024

Failing tests seem to be related to a broken minimum dependency about a missing VirtualFilesystemInterface::get() method.

@Toflar
Copy link
Collaborator

Toflar commented Dec 9, 2024

Guess we need to fix main first then.

Copy link
Collaborator

@Toflar Toflar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase on main

@Toflar Toflar changed the title Support indexed keys of uploads Support indexed keys of file uploads in file upload normalizer Dec 9, 2024
@Toflar Toflar merged commit 6c17b80 into main Dec 9, 2024
6 checks passed
@Toflar Toflar deleted the fix/upload branch December 9, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants