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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

david_garcia created an issue. See original summary.

david_garcia’s picture

Status: Active » Needs review
FileSize
1.91 KB

Fixed the regex + small doc issue.

yannickoo’s picture

FileSize
1.52 KB

I have rerolled the patch so it works with the latest version :)

budalokko’s picture

Could 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.

yannickoo’s picture

I 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 :)

khiminrm’s picture

budalokko’s picture

Status: Needs review » Fixed

I 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 !!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.