fix: move AssemblyAI transcript_id validation before try/except so ValueError propagates

This commit is contained in:
Ishaan Jaffer 2026-05-01 10:32:50 -07:00
parent 60e368e704
commit 1f8373d29c
No known key found for this signature in database

View file

@ -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}",