Skip to content

Commit ff3b120

Browse files
committed
CUST-4797 from field handle
1 parent a8cd1f3 commit ff3b120

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

nylas/resources/messages.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ def send(
170170
json_body = None
171171

172172
# From is a reserved keyword in Python, so we need to pull the data from 'from_' instead
173-
request_body["from"] = request_body.get("from_", None)
173+
# Handle both dictionary-style "from" and typed "from_" field
174+
if "from_" in request_body and "from" not in request_body:
175+
request_body["from"] = request_body["from_"]
176+
del request_body["from_"]
177+
# If "from" already exists, leave it unchanged
174178

175179
# Use form data only if the attachment size is greater than 3mb
176180
attachment_size = sum(

0 commit comments

Comments
 (0)