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

Đang mở
#1,744 8 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 10 ngày

@mystic-fae đang làm issue này rồi.

Từ ngày 19/11/2026.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
api, backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Python
Star
320
Fork
771
Merge trung bình
9 ngày 5 giờ
Pull request đã merge (30 ngày)
15

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AOSSIE-Org/PictoPy

Tất cả issue của AOSSIE-Org/PictoPy

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.