Repository navigation
Description
Description of the problem
Two files with the same basename, stored at the top level of two different upload directories and referenced from a Grid, have both been reported with a usage count of zero.
These should be independent file records with unique file_id values. Legacy-style references also include the upload-location ID, for example {filedir_1}image.jpg and {filedir_2}image.jpg, so the shared basename should not make the references ambiguous.
This is being reported separately from the multiple-File-column Grid rebuild defect so the duplicate-name/upload-directory behavior can be reproduced and diagnosed independently.
How To Reproduce
- Create two upload directories.
- Upload a file named
image.jpgat the top level of each directory. Confirm that the files have differentfile_idvalues. - Create a Grid containing a single native File column. Using only one File column avoids the separate multi-column accumulation issue.
- Reference the first
image.jpgfrom one entry and the secondimage.jpgfrom another entry. - Save both entries.
- Run Developer > Utilities > Update File Usage (or run
php system/ee/eecli.php sync:file-usage). - View the usage count/details for each file.
Reported result: both files show zero usage.
Expected result: each file is resolved by its unique file ID/upload location and shows the entry that references it.
Error Messages
No error is displayed. Both usage counts remain zero.
Screenshots / Videos / Template Code
Not currently available.
Environment Details:
- Version: ExpressionEngine 7; exact installed patch version pending confirmation
- PHP Version: pending confirmation
- MySQL Version: pending confirmation
- OS: pending confirmation
- Web Server: pending confirmation
Possible Solution
First confirm the raw Grid cell values and corresponding database records:
exp_files.file_idexp_files.upload_location_idexp_files.file_name- the value stored in
exp_channel_grid_field_* - matching rows, if any, in
exp_file_usage
The current rebuild query groups each lookup by both upload_location_id and file_name, so two top-level files in different upload locations should be distinguishable. If both still resolve to zero, the failure likely occurs before or after filename matching rather than being a simple basename collision.
Coverage should use two top-level files with the same basename in different upload destinations and assert that each produces the correct (file_id, entry_id) relationship.
Additional context
This report intentionally excludes subfolders. Files located in subfolders exercise different path-resolution logic and should be investigated separately if needed.
Activity