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
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m35s
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user