BUG: Corrupted image metadata causes HTTP 500, crashing the entire gallery view

Aperta
#1,744 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 10 giorni

@mystic-fae ci sta già lavorando.

Dal 19/11/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
api, backend

Direzione di ricerca

Read backend/AGENTS.md and compare the image handling in backend/app/routes/images.py (get_all_images() and search_images_by_tag()) with the validation handling in videos.py and video_util_to_video_data. Confirm how warnings are logged and how image records are validated. Done means a malformed record is logged and skipped while valid images still return successfully from both endpoints.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug enhancement
Is there an existing issue for this?
  • I have searched the existing issues
What happened?

I noticed that in backend/app/routes/images.py (get_all_images() and search_images_by_tag()), the app builds the list of images using a direct list comprehension.

If even one photo in the database has corrupted or unexpected metadata, Pydantic throws a ValidationError. Because it's trapped in a bare list comprehension, that single bad record crashes the entire endpoint with an HTTP 500. As a result, the user's whole gallery fails to load.

Why we should fix it
The project's own rulebook in backend/AGENTS.md is super clear about this.

videos.py already handles this gracefully, but images.py is missing the pattern.

The proposed fix
We can update the loop in images.py to go row by row using a try/except block (just like video_util_to_video_data). If a row fails validation, we can log a warning with the image ID, skip it, and let the rest of the healthy photos load successfully with a 200 response instead of crashing.

I want to work on this issue and open a PR about this .
Can assign this to me?

Record
  • I agree to follow this project's Code of Conduct
Lingua principale
Python
Stelle
320
Fork
771
Merge medio
9g 5h
PR unite (30g)
15

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AOSSIE-Org/PictoPy

Tutte le issue di AOSSIE-Org/PictoPy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.