Review main Merged

89882[BUGFIX] Respect workspace context resolving file metadata

Stefan Bürk CR +2 V +2 Easy +9 −2 updated 06/25/25, 18:54

Commit message

`sys_file_metadata` are workspaces aware and resolving
metadata within `MetaDataRepository::findByFileUid()`
should respect the context workspace.

This change adds now the workspace restriction to the
query created in `MetaDataRepository::findByFileUid()`
based on context information and limiting result to
max one item which is retrieved anyway.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Oli Bartsch +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oli Bartsch +1
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1215

  1. Stefan Bürk uploaded patch set 1 06/25/25, 15:00

  2. core-ci voted on patch set 1 V +1 06/25/25, 15:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80871

  3. Oli Bartsch commented on patch set 1 06/25/25, 15:24

    MetaDataRepository.php:119

    I don't quite get all the added ordering here. Shouldn't there be only one record for a fileUid in the default / -1 lamguage?
  4. Stefan Bürk commented on patch set 1 06/25/25, 15:41

    MetaDataRepository.php:119 Reply

    Within a workspace, yes. Will remove the orderings again .. still not sure with the workspace handling. Still investigating ...
  5. Stefan Bürk uploaded patch set 2 V +1 06/25/25, 15:44

  6. Andreas Kienast commented on patch set 1 06/25/25, 15:44

    MetaDataRepository.php:119 Reply

    Not when in use with workspaces, then you may get multiple records with the same file / sys_language_uid combination. I stumbled over this a few weeks ago, this fails in postgres as the order result is different to what existing tests expects. Since this patch adds `WorkspaceRestriction::class`, we _may_ get rid of the ordering again.
  7. Stefan Bürk commented on patch set 2 06/25/25, 15:48

    MetaDataRepository.php:119 Reply

    Exactly ... set to wip again. Trying to get some tests for that with the change.
  8. core-ci voted on patch set 2 V -1 06/25/25, 15:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80875

  9. Stefan Bürk uploaded patch set 3 V -1 06/25/25, 16:32

  10. core-ci voted on patch set 3 V +1 06/25/25, 16:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80880

  11. Stefan Bürk commented on patch set 3 06/25/25, 16:43

    MetaDataRepository.php:119 Reply

    `FileMetadataOverlayAspectTest` is exactly in place for this. It was pure luck that it retrieved the "correct" first record ... at least in test scenarious. Adding more fields to `sys_file_metadata` revealed that missbehaviour by missing a) determistic ordering and b) more precisly missing correct workspace restriction. See https://review.typo3.org/c/Packages/TYPO3.CMS/+/89087 (red) pipelines ....
  12. Oli Bartsch voted on patch set 3 CR +1 V +1 06/25/25, 17:53

  13. Andreas Kienast voted on patch set 3 CR +1 V +1 06/25/25, 17:57

  14. Stefan Bürk voted on patch set 3 CR +2 V +2 06/25/25, 18:00

  15. Stefan Bürk merged patch set 4 06/25/25, 18:54