Issue Bug New Stale

#110755Custom sys_file_metadata relations are skipped in the file reference count

Kevin Meier 09/20/26, 20:25 updated 09/20/26, 20:25

Description

Maybe “Bug” is not the right tracker, but here goes. Pretty much since ever (at least since TYPO3 8) references from sys_file to sys_file_metadata were skipped for counting references. The code responsible (EXT:filelist/Classes/FileList.php) describes in its function getFileReferenceCount:

> Counts how often the given file is referenced. This is done by looking up the file in the “sys_refindex” table, while excluding sys_file_metadata relations as these are no such references.

While this kind of makes sense (since any file edited gets this reference and usually users don’t care about that reference), this has one caveat: If an extension (e.g. EXT:poster_image) extends sys_file_metadata and adds an url type field to it, it is not counted as a reference and other extensions copying/relying on that counting technique (e.g. EXT:wv_file_cleanup) have false positives in determining the files to be deleted. What makes this a little more confusing: If you click on the reference count of a file with actual references (opening an overlay of the file) and scroll down, said sys_file_metadata reference is listed again next to the actual references which just feels inconsistent.

I am not sure what’s the right approach to this: Either sys_file_metadata references should be filtered out more strictly (only if field is set to file) or this reference shouldn’t be listed in the overlay. Depending on what’s the right approach moving forward, EXT:filelist and possibly third party extensions might need to be adapted in that regard.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Custom sys_file_metadata relations are skipped in the file reference count Resolves: #110755 Releases: main