One object that does not parse makes a post-filtered search() raise for the whole calendar
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đá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
- 65/100
Hướng nghiên cứu
Start with _filter_search_results() in caldav/search.py around line 80 and trace how ValueError is handled during post-filtering. Reproduce with the supplied malformed VTODO and valid object, then check existing tests for client-side search filtering. Done when a malformed object no longer makes the whole search raise and the caller can learn which object failed, as the issue requests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Disclaimer: AI-generated text below the line, generated by Claude Opus 5.5.
Found while working on https://github.com/pycalendar/calendaring/pull/13
When Calendar.search() filters the results on the client side, one stored object that icalendar cannot parse makes the whole search raise a plain ValueError. None of the other objects come back.
_filter_search_results() (caldav/search.py, around line 80) calls searcher.check_component(o, ...), and on ValueError falls back to o.icalendar_instance.subcomponents. That parses the same data again, so it raises again:
try:
filtered = searcher.check_component(o, expand_only=not post_filter)
except ValueError:
filtered = [
x for x in o.icalendar_instance.subcomponents if not isinstance(x, Timezone)
]
The post-filter is on by default in many cases (search.py, "Setting default value for post_filter"). Among them: a time range that caldav widened itself, todo=True without include_completed, and any server without search.text.case-sensitive (per the hints: Radicale, SOGo, CCS, Stalwart), where it is on for every search. get_object_by_uid() always post-filters. So on those servers, one malformed object written by some other client makes every search in that calendar fail.
Reproduction against caldav 3.6.0, without a server:
from caldav import DAVClient
from caldav.calendarobjectresource import Todo
from caldav.search import CalDAVSearcher, _filter_search_results
BAD = ("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//some client//EN\r\nBEGIN:VTODO\r\nUID:from-phone\r\n"
"DTSTAMP:20261001T000000Z\r\nSUMMARY:buy milk\r\nDUE:2026-10-20\r\nEND:VTODO\r\nEND:VCALENDAR\r\n")
GOOD = BAD.replace("UID:from-phone", "UID:good").replace("DUE:2026-10-20", "DUE;VALUE=DATE:20261020")
client = DAVClient(url="https://caldav.example.com/")
objects = [Todo(client=client, url=f"https://caldav.example.com/cal/{n}.ics", data=d)
for n, d in (("good", GOOD), ("bad", BAD))]
searcher = CalDAVSearcher(todo=True)
print(len(_filter_search_results(objects, searcher, post_filter=False))) # 2
_filter_search_results(objects, searcher, post_filter=True)
# ValueError: Expected datetime, date, or time. Got: '2026-10-20'
(DUE:2026-10-20 is not a valid DATE value; such data is out there.)
Possible fix: skip an object that does not parse, with a log warning, or collect such objects and hand them back to the caller, instead of letting the exception escape. Skipping silently would hide data, so some way for the caller to learn about the skipped objects would be better.
- Ngôn ngữ chính
- Python
- Star
- 412
- Fork
- 113
- Merge trung bình
- 9 giờ 52 phút
- Pull request đã merge (30 ngày)
- 64
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 python-caldav/caldav
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
python-caldav/caldav#792 ·
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 68/100
python-caldav/caldav#788 ·
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 62/100
python-caldav/caldav#687 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ical + caldavĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
python-caldav/caldav#825 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
python-caldav/caldav#823 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của python-caldav/caldav
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
NVIDIA/flare-local-inference#90 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/streaming comp/gateway P2 platform/telegram type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NousResearch/hermes-agent#144897 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
request-theme
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
LizardByte/ThemerrDB#9575 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Author Page: noshin-nawalĐang mởauthor-page correction
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
acl-org/acl-anthology#10599 · 1 bình luận ·
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
zilliztech/memsearch#818 ·
Maintainer thường phản hồi trong vòng 1 ngày