Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Imagine file metadata is never updated when a variant is stored again, so mediaObjects keep a changed filter's old type and size

Cerrado
#421 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Ya se ha fusionado un pull request relacionado.

  • #422 de @silverbackdan — fusionado

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
63/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php, symfony

Línea de trabajo

Start by tracing ImagineEventListener::onStore() into FileInfoCacheManager::saveCache() and inspect how readStoredFilteredImageInfo uses that method. Check the existing tests for stored variants and cached metadata, then add coverage for storing the same (path, filter) again. Done means refreshed metadata reflects the stored file’s MIME type, size, and dimensions while the read path remains safe from concurrent inserts.

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

Descripción

Problem

FileInfoCacheManager::saveCache() returns early when a row already exists for the (path, filter):

if ($this->resolveCache($fileInfo->path, $fileInfo->filter)) {
    return;
}

ImagineEventListener::onStore() goes through saveCache(). So when a variant is stored again, its metadata row keeps the old values. Changing a filter's format, quality or size and running imagine:generate writes the new files, but _metadata.mediaObjects keeps serving the old mimeType, fileSize and dimensions.

Seen in production (template alpha.25 → alpha.27, every filter switched to format: webp)

  • Every variant now has a .webp file and a .webp contentUrl. Its metadata row still says image/png / image/jpeg, with the old file size.
  • Example file media objects for one image: original 2124 px PNG at 3.69 MB. The general row says image/png at 1.58 MB (the stored WebP is 41 KB). The large row says image/png, 2124 px wide, at 4.69 MB (the stored WebP is 91 KB).
  • @cwa/nuxt's srcset keeps one candidate per width, the smallest by fileSize. Here large and the original are both 2124 px wide, and large is recorded as the bigger file. So the original goes into the srcset in place of large. Retina screens then download the 3.7 MB PNG (12.7 s on a test request) in place of the 91 KB WebP.
  • This hits every image whose original is no wider than large, which is most uploads.

Suggested fix

  • Store events: a stored variant should replace its metadata. onStore() could upsert, or delete the (path, filter) row before inserting. saveCache() can stay insert-only for the read path (readStoredFilteredImageInfo), where it guards against concurrent inserts.
  • Existing sites: add an upgrade note to delete the stale variant rows after a filter change, so they are re-read from the stored files on the next render:
    DELETE FROM _acb_imagine_cached_file_metadata WHERE filter <> '';
    
    then purge the HTTP cache. Alternatively, imagine:generate could refresh the metadata of any variant whose row doesn't match the stored file.
Lenguaje dominante
PHP
Estrellas
32
Forks
8
Merge medio
40 min
PR fusionados (30 d)
133

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

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 components-web-app/api-components-bundle

Todos los issues de components-web-app/api-components-bundle

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.