BUG: Incomplete filesystem scans can delete indexed media records
Maintainer thường phản hồi trong vòng 3 ngày
@swastiksharma45 đang làm issue này rồi.
Từ ngày 21/11/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
No files are named, so start by tracing the folder-synchronization path in the Python backend: find where the scan is invoked, where PermissionError/OSError is caught and turned into an empty or partial file list, and the obsolete-media cleanup step that runs afterwards against the database. Read the reproduce steps as the test plan — restricted permissions on an indexed directory, then a sync. Done means an incomplete scan is distinguishable from a successful empty one, cleanup is skipped or narrowed for it, and regression tests cover permission failures and inaccessible subdirectories.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is there an existing issue for this?
- I have searched the existing issues
What happened?
When PictoPy encounters filesystem access errors during media scanning, such as PermissionError or other OSError exceptions, the scan may return an empty or incomplete list of media files.
The synchronization process can subsequently continue into obsolete-media cleanup, treating media that could not be inspected as missing. This can result in existing image or video records being deleted from the database even though the underlying files still exist.
This is particularly dangerous when scanning external drives, mounted directories, or libraries containing folders with restricted permissions or temporary filesystem access failures.
Steps to Reproduce
- Add a folder containing images and/or videos to PictoPy.
- Allow the initial scan to complete so that the media is indexed in the database.
- Verify that the indexed media appears in PictoPy.
- Temporarily restrict read/list permissions on the indexed directory or one of its subdirectories, or simulate a filesystem access failure.
- Trigger folder synchronization.
- Restore the original filesystem permissions.
- Check whether previously indexed media records have been removed from PictoPy despite the corresponding files still existing on disk.
Expected Behavior
- A failed or incomplete filesystem scan should not be interpreted as a successful scan containing zero media files.
- Existing indexed media records should be preserved when directories cannot be accessed or enumerated.
- Obsolete-media cleanup should only run for directories that were scanned successfully and completely.
- Temporary permission errors, unavailable external drives, and filesystem access failures should not cause indexed media or their associated metadata to be deleted.
Actual Behavior
Based on the synchronization and cleanup code paths, filesystem scan errors may be caught and converted into empty or partial scan results without reliably indicating that the scan failed.
The synchronization process can still reach obsolete-media cleanup, where media that was not discovered during the incomplete scan may be treated as deleted.
This can cause existing database records and associated data, including thumbnails and AI-generated metadata, to be removed even though the original media files have not actually been deleted.
Impact
- Existing images or videos may disappear from the PictoPy library.
- Indexed metadata may be deleted.
- AI-generated tags, face data, embeddings, and related records may be lost depending on database relationships and cleanup behavior.
- External-drive disconnections or temporary permission problems may result in unintended library data loss.
- Users may need to rescan and reprocess media to restore their library state.
Suggested Fix
- Distinguish successful, incomplete, and failed directory scans.
- Prevent obsolete-media cleanup from running against incomplete scan results.
- Preserve indexed records when filesystem access fails or the scan cannot reliably establish that media is missing.
- Make cleanup error-aware instead of treating inaccessible paths as confirmed deletions.
- Add regression tests covering permission failures, inaccessible subdirectories, failed directory enumeration, and unavailable external storage.
Record
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Python
- Star
- 322
- Fork
- 793
- Merge trung bình
- 6 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 21
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AOSSIE-Org/PictoPy
-
bug enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
AOSSIE-Org/PictoPy#1788 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
AOSSIE-Org/PictoPy#1786 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)Có thể đã có người làm @omkar-suryavanshi đã nhận 2 ngày trước. Đang mởbug enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
AOSSIE-Org/PictoPy#1780 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't workCó thể đã có người làm @swastiksharma45 đã nhận 4 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
AOSSIE-Org/PictoPy#1779 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
BUG: PROD: Face search shows "No Matches Found" for every empty result, even when AI tagging is offCó thể đã có người làm @Piyush0000 đã nhận 1 ngày trước. Đang mởbug enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
AOSSIE-Org/PictoPy#1770 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của AOSSIE-Org/PictoPy
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
comet-ml/opik#9877 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Resource]: FlavianĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
hesreallyhim/awesome-claude-code#3736 · 1 bình luận ·
-
area: trackers bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Review: WordPress copy/snapshot download media with no size cap and a hostname-only origin checkĐang mởperformance product:quill
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Community-Access/quill#2634 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày