diff --git a/app.py b/app.py index d6aaa9d..16afbe6 100644 --- a/app.py +++ b/app.py @@ -12,7 +12,6 @@ from werkzeug.security import generate_password_hash, check_password_hash import markdown import logging import re -from urllib.parse import quote from email import message_from_string from email.mime.text import MIMEText from whoosh.index import create_in, open_dir @@ -360,9 +359,9 @@ def rewrite_eml_file_links(md_content, filepath): # Ensure forward slashes for URL resolved_path = resolved_path.replace(os.sep, '/') - # URL-encode the path, preserving forward slashes - encoded_path = quote(resolved_path, safe='/') - file_url = f"/file/{encoded_path}" + # Do NOT URL-encode here - the browser will encode the href attribute automatically + # when creating the HTTP request (otherwise we get double encoding) + file_url = f"/file/{resolved_path}" return f"[{link_text}]({file_url})"