Same-named files in different upload directories report zero Grid usage

Abierto
#5,409 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
php
Área
backend

Línea de trabajo

Start by reproducing with two top-level files that share a basename in different upload locations, then run php system/ee/eecli.php sync:file-usage and inspect the rows in exp_files (file_id, upload_location_id, file_name), the raw values in exp_channel_grid_field_*, and exp_file_usage. Find where the rebuild's lookup by upload_location_id and file_name returns no match, since the issue says the grouping should already separate these files. Done means each file gets the correct (file_id, entry_id) usage row, with a test covering two same-named top-level files.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug: Unconfirmed

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

  1. Create two upload directories.
  2. Upload a file named image.jpg at the top level of each directory. Confirm that the files have different file_id values.
  3. Create a Grid containing a single native File column. Using only one File column avoids the separate multi-column accumulation issue.
  4. Reference the first image.jpg from one entry and the second image.jpg from another entry.
  5. Save both entries.
  6. Run Developer > Utilities > Update File Usage (or run php system/ee/eecli.php sync:file-usage).
  7. 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_id
  • exp_files.upload_location_id
  • exp_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.

Lenguaje dominante
PHP
Estrellas
505
Forks
135
Merge medio
3 d 7 h
PR fusionados (30 d)
7

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ExpressionEngine/ExpressionEngine

Todos los issues de ExpressionEngine/ExpressionEngine

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.