- Issue created by @alexpott
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
alexpott β credited larowlan β .
- First commit to issue fork.
- Merge request !118Add exception and throw it for validation errors β (Open) created by phenaproxima
- Status changed to Needs review
8 months ago 6:30pm 19 April 2024 - πΊπΈUnited States phenaproxima Massachusetts
This was tricky, and revealed a flaw in our handling of duplicate file entities.
Turns out file entities cannot be duplicated by URI. That's validated at the entity level. Yet we specifically test for that -- the only reason that test passed before, is because we weren't doing entity validation.
So I refactored the file handling logic to do this, in order:
- If there's no physical source file to be copied, there's nothing we can do. (This is the existing behavior.)
- If the source file and destination file exist, but have different contents, then ensure the destination file will have a different name. (This is the existing behavior, changed slightly.)
- Now that we know the destination URI, check if there's a file entity that already has it. If there is, then don't import the incoming file entity -- just use the existing one, and ensure that any other entities being imported in the current batch which reference the new file entity, will actually reference the existing one.
- Finally, if there is no file entity for the destination URI, copy the physical file and update the URI of the file entity we're importing.
The test coverage probably has some gaps, and I do need to write explicit coverage that validation is triggered, but this is progress...
- Status changed to Postponed
8 months ago 6:00pm 23 April 2024 - πΊπΈUnited States phenaproxima Massachusetts
I suspect the test failures here are linked to #3442024: Account switching to user 1 is now fraught β , so postponing this issue on that one.
- Status changed to Needs work
8 months ago 12:06pm 24 April 2024 - Status changed to Needs review
8 months ago 5:53pm 25 April 2024 - Status changed to Needs work
8 months ago 10:43pm 25 April 2024 - π¬π§United Kingdom alexpott πͺπΊπ
Great to see this close. I think the exception needs to have the file that caused it - if possible - or if not then the uuid not the ID.
Fixed a bug on the MR by moving the validation into the loop.
- Status changed to Needs review
8 months ago 1:13pm 26 April 2024 - Status changed to Fixed
8 months ago 9:06am 30 April 2024 - π¬π§United Kingdom alexpott πͺπΊπ
Committed and pushed 1736da1fcc5 to 11.x and f665255f6e7 to 10.3.x. Thanks!
-
alexpott β
committed f665255f on 10.3.x
Issue #3442022 by phenaproxima, alexpott, larowlan: Trigger entity...
-
alexpott β
committed f665255f on 10.3.x
-
alexpott β
committed 1736da1f on 11.x
Issue #3442022 by phenaproxima, alexpott, larowlan: Trigger entity...
-
alexpott β
committed 1736da1f on 11.x
- π¬π§United Kingdom alexpott πͺπΊπ
Cherry-picked to β¨ Add recipes api as experimental API to core Needs review
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
This looks like a crucial addition for the "default content" functionality!
Check default content module for any existing issues about this.
Dare I ask β¦ what was the outcome of this? π«£
- π¬π§United Kingdom alexpott πͺπΊπ
@Wim Leers in true Drupal fashion it does not look like entity validation has been considered... see
https://www.drupal.org/project/issues/default_content?text=validation&st... β
https://www.drupal.org/project/issues/default_content?text=validate&stat... β Automatically closed - issue fixed for 2 weeks with no activity.