[Test] Add unit coverage for content-based file type detection
Maintainer thường phản hồi trong vòng 1 ngày
@srivarshni7 đang làm issue này rồi.
Từ ngày 2/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
- 78/100
Hướng nghiên cứu
Bắt đầu với bốn hàm hỗ trợ trong utilities/file_types.py: sniff_magic, detect_type_key, type_label và guess_kind. Xem tests/test_file_type_icons.py để nắm kiểu viết test hiện có, rồi thêm một module test mới không phụ thuộc Qt. Hoàn thành khi magic bytes của PNG hoặc PDF được ưu tiên hơn phần mở rộng tệp mâu thuẫn, .tar.gz được nhận diện đúng, tệp nhị phân không rõ được đưa về nhóm an toàn và các test chạy được mà không cần QApplication.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
utilities/file_types.py contains content sniffing and compound-extension handling, but the test suite currently has no focused tests for these helpers. Regressions could affect file labels and preview selection without being detected.
Proposed solution
Add a small, Qt-independent test module covering sniff_magic, detect_type_key, type_label, and guess_kind. Use representative byte samples and filenames to verify magic bytes take precedence over extensions, .tar.gz is handled correctly, text and unknown data are classified safely, and case-insensitive extensions work.
Acceptance criteria
- Tests cover at least PNG/PDF or another representative magic-byte pair.
- A content type overrides a conflicting filename extension.
- Compound extensions such as
.tar.gzare covered. - Unknown binary data falls back to the expected safe category.
- Tests run without creating a Qt application.
Security considerations
Tests must use synthetic data only and must not weaken or bypass encryption behavior.
Additional context
Relevant file: utilities/file_types.py; existing UI icon tests are in tests/test_file_type_icons.py.
- Ngôn ngữ chính
- Python
- Star
- 1
- Fork
- 5
- Merge trung bình
- 4 giờ 22 phút
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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 ANCORATE/EncryptHome
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ANCORATE/EncryptHome#24 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ANCORATE/EncryptHome#17 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue ux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ANCORATE/EncryptHome#10 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ANCORATE/EncryptHome
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
igormcsouza/tether#278 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
aws-samples/sample-per-model-bedrock#803 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
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 78/100
huggingface/accelerate#4511 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
follow-up
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày