fix: 智能纪要链接不再吞 JSON 引号
This commit is contained in:
@ -14,7 +14,8 @@ class CalendarError(RuntimeError):
|
|||||||
|
|
||||||
AI_NOTES_CHAT_ID = "7391681490647744513"
|
AI_NOTES_CHAT_ID = "7391681490647744513"
|
||||||
AI_NOTES_URL_RE = re.compile(
|
AI_NOTES_URL_RE = re.compile(
|
||||||
r"https://[A-Za-z0-9.-]+\.feishu\.cn/(?:docx|minutes)/[A-Za-z0-9]+(?:\?[^\s\x00-\x1f]*)?"
|
r"https://[A-Za-z0-9.-]+\.feishu\.cn/(?:docx|minutes)/[A-Za-z0-9]+"
|
||||||
|
r"(?:[?][^\s\x00-\x1f\"<>]+)?"
|
||||||
)
|
)
|
||||||
TOPIC_RE = re.compile(r"Topic:\s*([^\n]+?)(?=Owner:|\Z)")
|
TOPIC_RE = re.compile(r"Topic:\s*([^\n]+?)(?=Owner:|\Z)")
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,17 @@ def test_extract_topic_from_card_text():
|
|||||||
assert _extract_topic("https://efund.feishu.cn/docx/abc") == ""
|
assert _extract_topic("https://efund.feishu.cn/docx/abc") == ""
|
||||||
|
|
||||||
|
|
||||||
|
def test_ai_notes_url_regex_stops_before_json_quote():
|
||||||
|
from snooper_calendar import AI_NOTES_URL_RE
|
||||||
|
|
||||||
|
json_text = (
|
||||||
|
'{"text": "https://efund.feishu.cn/docx/abc123?dcuId=7&from=vc#doxcnX", '
|
||||||
|
'"richText": {}}'
|
||||||
|
)
|
||||||
|
urls = AI_NOTES_URL_RE.findall(json_text)
|
||||||
|
assert urls == ["https://efund.feishu.cn/docx/abc123?dcuId=7&from=vc#doxcnX"]
|
||||||
|
|
||||||
|
|
||||||
def test_fetch_ai_notes_links_reads_topic_from_local_content():
|
def test_fetch_ai_notes_links_reads_topic_from_local_content():
|
||||||
tz = ZoneInfo("Asia/Shanghai")
|
tz = ZoneInfo("Asia/Shanghai")
|
||||||
storage = SnifferStorage(url="sqlite:///:memory:")
|
storage = SnifferStorage(url="sqlite:///:memory:")
|
||||||
|
|||||||
Reference in New Issue
Block a user