Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've develop a widget integration for file fields using the FormElement provided by this module.
While doing so, I found out that the regular expressions used to process incoming elements from the client don't cover all cases.
The unique strings generated by Drupal 8 that are appended to ID's on ajax requests to prevent collisions can contain underscores and slashes such as...
'form-edit-0--Nd25Pq-Abpo'
This prevents the form element from processing incoming files when it is working with elements submited vía ajax where these id's are not properly processed.
Comment | File | Size | Author |
---|---|---|---|
#3 | plupload-regex-2645658-3.patch | 1.52 KB | yannickoo |
Comments
Comment #2
david_garcia CreditAttribution: david_garcia commentedFixed the regex + small doc issue.
Comment #3
yannickooI have rerolled the patch so it works with the latest version :)
Comment #4
budalokko CreditAttribution: budalokko commentedCould you please clarify what's the difference in the result of uploading files before and after applying the patch?
I did some tests with a Drupal 8.1 install only with plupload and plupload_widget modules enabled and the patch from #2782671: Fix selector in JavaScript file applied (otherwise there was an interfering Javascript error).
The result was that I could see the mentioned unique strings appended to IDs, but after node submission I finished in the same situation with and without applying the patch:
I also noticed that just after uploading the file the patched piece of code gets executed twice, the first without the unique strings appended and the second with them.
Please direct me a bit. After my tests I think the first chunk of the patch is fine and should go in, but specially the reason of the second chunk is unclear to me.
Comment #5
yannickooI had to refactor several parts of this module otherwise it couldn't work in a reliable way. I will share my patch with you guys so we can simplify the implementation over in Plupload Widget :)
Comment #6
khiminrm CreditAttribution: khiminrm at Lemberg Solutions commentedPatch from #3 fixes issue https://www.drupal.org/project/plupload_widget/issues/2935378
Comment #8
budalokko CreditAttribution: budalokko commentedI could see the necessity of second chunk, which as I mentioned before I didn't understand, thanks to the related issue #2935378: Value of field can't be edited so commited.
Thanks !!