From 1f8373d29caaa3d0f569a204d3319d3c60ee7edb Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 1 May 2026 10:32:50 -0700 Subject: [PATCH] fix: move AssemblyAI transcript_id validation before try/except so ValueError propagates --- .../assembly_passthrough_logging_handler.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/assembly_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/assembly_passthrough_logging_handler.py index 74491f283a1..6277f6b4a75 100644 --- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/assembly_passthrough_logging_handler.py +++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/assembly_passthrough_logging_handler.py @@ -204,15 +204,15 @@ class AssemblyAIPassthroughLoggingHandler: ) if _api_key is None: raise ValueError("AssemblyAI API key not found") + if ( + any(c in transcript_id for c in ("/", "\\", "#", "?")) + or ".." in transcript_id + ): + raise ValueError( + f"Invalid transcript_id {transcript_id!r}: contains disallowed characters" + ) + safe_transcript_id = urllib.parse.quote(transcript_id, safe="") try: - if ( - any(c in transcript_id for c in ("/", "\\", "#", "?")) - or ".." in transcript_id - ): - raise ValueError( - f"Invalid transcript_id {transcript_id!r}: contains disallowed characters" - ) - safe_transcript_id = urllib.parse.quote(transcript_id, safe="") url = f"{_base_url}/v2/transcript/{safe_transcript_id}" headers = { "Authorization": f"Bearer {_api_key}",