fix: ignore string literals 'null' and 'undefined' from frontend form data for optional fields
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m35s

This commit is contained in:
2026-05-17 18:52:44 +02:00
parent 6a6b510e56
commit 10c9a14487

View File

@@ -526,6 +526,13 @@ async def translate_document_v1(
tier = _tier_for_quota(current_user.plan)
user_id = current_user.id
# Clean up form data (frontend might send "null" or "undefined" as strings)
if glossary_id in ("null", "undefined", ""): glossary_id = None
if custom_prompt in ("null", "undefined", ""): custom_prompt = None
if prompt_id in ("null", "undefined", ""): prompt_id = None
if file_url in ("null", "undefined", ""): file_url = None
if file_url:
if tier == "free":
raise TranslateEndpointError(