- Issue created by @herved
- last update
11 months ago 5 pass - Status changed to Needs review
11 months ago 12:16pm 28 May 2024 - Status changed to Needs work
11 months ago 12:38pm 29 May 2024 - ππΊHungary huzooka Hungary ππΊπͺπΊ
I am not able to reproduce the issue with Drupal 10.3.x-dev (d4883273125fe) and File URL 2.x HEAD (commit https://git.drupalcode.org/project/file_url/-/commit/2598cbf53c8df4424b8...).
After typing in 'foo' in the remote file url input, I cannot simply switch to the "Upload file" radio and get a file upload input unless I click the "Remove" button. After I do that, I can upload a file without any issue, and the test entity is saved as expected.
Could you please extend
FileUrlWidgetTest
and reproduce the error? - ππΊHungary huzooka Hungary ππΊπͺπΊ
Adding screenshot about what I see on my test environment.
- π§πͺBelgium herved
#4 #5 This patch here prevents exactly that.
In the value callback, the URL now gets validated before is gets added as a field item.PS: I re-tested on a clean 10.3.x core and file_url 2.x and found another issue, see π URL not sumbitted (missing context in JS behavior detach Active
- π§πͺBelgium herved
Got it, #4 is when testing with a single-valued field (see point 1 below).
I was initially testing with multi-valued fields.To clarify, the patch prevents invalid URLs to be added as a field item. This fixes 2 issues:
1. For single-valued fields, after submitting an invalid URL, and clicking back on "Upload file" radio, the file upload field is not visible anymore. This comes fromManagedFile::preRenderManagedFile
interfering, as it sets the#access
toFALSE
if$element['#value']['fids']
is populated
2. For multi-valued fields, after submitting an invalid URL, an empty/broken field item gets added. - Status changed to Needs review
11 months ago 3:07pm 30 May 2024 - last update
10 months ago 9 pass