Skip to content

fix(transcribe): normalize www.-prefixed URLs before validation#2021

Open
kimdzhekhon wants to merge 1 commit into
Graphify-Labs:v8from
kimdzhekhon:fix/transcribe-www-url-normalize
Open

fix(transcribe): normalize www.-prefixed URLs before validation#2021
kimdzhekhon wants to merge 1 commit into
Graphify-Labs:v8from
kimdzhekhon:fix/transcribe-www-url-normalize

Conversation

@kimdzhekhon

Copy link
Copy Markdown

Summary

Found via code review, not tied to an existing issue.

  • is_url() classifies a scheme-less "www.youtube.com/watch?v=..." input as a URL (www. is in URL_PREFIXES), but download_audio() passed that raw string straight to security.validate_url(), which rejects anything without an http/https scheme.
  • transcribe_all() only logs the resulting ValueError as warning: could not transcribe ... and silently drops the file — so any www.-form URL input failed unconditionally, with no clear signal why.
  • Adds _normalize_url(): prepends https:// to www.-prefixed input before it reaches validate_url()/yt-dlp. Already-scheme'd URLs and plain file paths pass through unchanged.

Test plan

  • Added tests in tests/test_transcribe.py: www. input gets https:// prepended; already-scheme'd URLs and file paths are untouched; is_url()'s existing detection behavior is unchanged
  • uv run pytest tests/test_transcribe.py -q — 19 passed
  • uv run pytest tests/ -q — full suite: 3419 passed (5 pre-existing failures unrelated to this change, missing optional openai dependency in this environment)

is_url() classifies a scheme-less "www.youtube.com/watch?v=..." input as
a URL (it's in URL_PREFIXES), but download_audio() passed that raw
string straight to security.validate_url(), which rejects it for
having no http/https scheme. transcribe_all() only logs the resulting
ValueError as a warning and silently drops the file, so any www.-form
URL failed unconditionally.

Add _normalize_url(): prepends https:// to www.-prefixed input before
it reaches validate_url()/yt-dlp. Already-scheme'd URLs and plain file
paths pass through unchanged.

Found via codex-assisted code review, verified against the actual code
before delegating the fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant