I am using s3fs_cors along with inline_entity_form and entity_browser, and have been experiencing issues with getting the upload to work.
I have an s3fs_cors field on a media entity called 'File'. Uploads work fine when adding via media/add/file.
Another way that I can upload files is through a normal content type (Article) and clicking the File icon in the ckeditor for the body field. This is set up to open an Entity Browser that displays the media file form in an iframe. This is where the file upload fails, so I started digging in. This actually lead to two different problems. The first one was solved by this patch: https://www.drupal.org/project/s3fs_cors/issues/2985826. After using that patch, there wouldn't be a javascript error (because of not using the correct field name), but the file field would just disappear after selecting a file to upload. This is because the value passed in `element_parents` is incorrect. The JS code always sets `element_parents` to `field_name_key + '/widget'`, but it should be set to an implosion of the element's parents. I've found by changing it to this, it now works with entity_browser, and also still works on media/add/file.
Patch to follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | s3fs_cors-2991995-element-parents-11.patch | 892 bytes | jayelless |
| #8 | s3fs_cors-2991995-element-parents-8.patch | 925 bytes | jayelless |
| #3 | s3fs_cors-element_parents-2991995-3.patch | 1.38 KB | bdlangton |
| #2 | s3fs_cors-element_parents-2991995-2.patch | 1.34 KB | bdlangton |
Comments
Comment #2
bdlangton commentedComment #3
bdlangton commentedThe previous patch only applies cleanly after the patch here is applied: https://www.drupal.org/project/s3fs_cors/issues/2985826
So here is a new patch that applies against 8.x-1.x.
Comment #5
jayelless commented@bdlangton. Thanks for the patch. Now committed.
Comment #6
jayelless commentedComment #7
jayelless commentedRe-opening this issue, as the applied patch results in the following messages in the watchdog log:
and the display does not correctly update with the uploaded file.
Comment #8
jayelless commentedNew patch attached. Apply to latest dev version (or after applying one of the previous patches for this issue).
Comment #9
jayelless commented@bdlangton: Can you please confirm that your system still uploads correctly with the patch from #8 applied? Please also confirm that it continues to work when the field is configured for more than one file. Thanks.
Comment #10
jayelless commentedComment #11
jayelless commentedPatch re-rolled for latest version.
@bdlangton: Can you please confirm that your system still uploads correctly with this patch applied? Please also confirm that it continues to work when the field is configured for more than one file. Thanks.
Comment #12
bdlangton commented@jlscott Sorry for the delay. The patch still works for me and works when using it on a multi-value field.
Comment #14
jayelless commentedThanks @bdlangton. Patch committed.
Comment #15
jayelless commented