Skip to content

Commit 9a3010b

Browse files
committed
Set MAX_ATTACHMENT_SIZE for emailed transcript to 2MB
1 parent a5022c8 commit 9a3010b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

backend/tenantfirstaid/feedback.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import os
66
from typing import Optional, Tuple
77

8+
MAX_ATTACHMENT_SIZE: int = 2 * 1024 * 1024
9+
810

911
def convert_html_to_pdf(html_content: str) -> Optional[bytes]:
1012
pdf_buffer = BytesIO()
@@ -26,6 +28,9 @@ def send_feedback() -> Tuple[str, int]:
2628
if pdf_content is None:
2729
return "PDF conversion failed", 500
2830

31+
if len(pdf_content) > MAX_ATTACHMENT_SIZE:
32+
return "Attachment too large", 400
33+
2934
try:
3035
msg = EmailMessage(
3136
subject="Feedback with Transcript",

0 commit comments

Comments
 (0)