fix(email): afișează expeditorul și subiectul original la emailuri forwarded
La salvarea unui email forwardat, se extrage acum expeditorul original din body și se elimină prefixul Fwd: din titlu — în loc de adresa lui Marius. Corectat și fișierul deja salvat din 07 mai. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -215,7 +215,11 @@ def save_email_as_note(eid: str) -> dict:
|
||||
slug = slugify(subject) or 'email'
|
||||
filename = f"{date_prefix}_{slug}.md"
|
||||
filepath = KB_PATH / filename
|
||||
|
||||
|
||||
# For forwarded emails: extract original sender and strip Fwd: prefix from subject
|
||||
display_from = extract_original_sender(subject, body, from_addr)
|
||||
display_subject = re.sub(r'^(Fwd?|Fw)\s*[:\s]\s*', '', subject, flags=re.IGNORECASE).strip() or subject
|
||||
|
||||
# Build attachments section
|
||||
attachments_section = ""
|
||||
if attachments:
|
||||
@@ -223,9 +227,9 @@ def save_email_as_note(eid: str) -> dict:
|
||||
attachments_section = f"\n## Atașamente\n{att_list}\n"
|
||||
|
||||
# Create markdown note
|
||||
content = f"""# {subject}
|
||||
content = f"""# {display_subject}
|
||||
|
||||
**De la:** {from_addr}
|
||||
**De la:** {display_from}
|
||||
**Data:** {date_str}
|
||||
**Salvat:** {datetime.now().strftime('%Y-%m-%d %H:%M')}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user