ValidateFileUsage does not seem to pick up img src and deletes image files actually being used

Created on 21 June 2021, over 3 years ago
Updated 27 January 2023, almost 2 years ago

there is an image in a body field of a node like this
<img alt="" src="/sites/default/files/media/inline-images/abc.jpg" />
which exists on the file system

This module can find it and deletes it even thought the "Validate file being used in wysiwyg text fields site-wide." is checked

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇬🇷Greece giorgosk Chios, Greece 🇬🇷

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany broon Potsdam

    There are two issues here, both related to the generated queries.

    First is, that the module generates one query per entity type and adds _all_ eligible fields from _all_ available bundles. However, the table JOIN is INNER and thus it could only work like that on bundles that contain _all_ WYSIWYG fields. This should be changed to LEFT JOIN.

    Secondly, the WHERE clause also checks _all_ eligible fields of that entity type and concats them with AND. This should be changed to OR.

    With both of these changes in SQL, I was able to correctly find occurrences of my unmanaged files.

  • 🇩🇪Germany broon Potsdam

    The culprit is in the usage of orConditionGroup(). The attached patch fixes that.

  • Status changed to Needs review almost 2 years ago
Production build 0.71.5 2024