fix: support youtu.be short URLs in YouTubeConverter#1705
Open
octo-patch wants to merge 3 commits intomicrosoft:mainfrom
Open
fix: support youtu.be short URLs in YouTubeConverter#1705octo-patch wants to merge 3 commits intomicrosoft:mainfrom
octo-patch wants to merge 3 commits intomicrosoft:mainfrom
Conversation
added 3 commits
April 8, 2026 13:35
…icrosoft#1660) Previously ExifTool was only auto-discovered if found directly in a trusted directory (e.g. C:\Program Files). Common Windows installs place the binary one level deeper (C:\Program Files\ExifTool\exiftool.exe), so dirname returned a path that failed the exact-equality check and ExifTool was silently not used. Switch to startswith(d + os.sep) to allow subdirectory matches while keeping the exact-match check, preserving the security boundary. Also add C:\Windows as a trusted root since ExifTool is sometimes installed there directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1704
Problem
YouTubeConverter.accepts()only matched URLs starting withhttps://www.youtube.com/watch?, silently rejecting theyoutu.be/<id>short URL format that YouTube's share button produces by default.Additionally,
convert()extractedvideo_idonly from thevquery parameter, which is absent inyoutu.be/<id>URLs where the video ID is in the URL path.Solution
accepts()to useurlparsefor host-based matching, accepting bothwww.youtube.com/watchandyoutu.behostnames (also addsyoutube.comwithoutwww.for robustness)convert()to extractvideo_idfrom the URL path whenhostname == "youtu.be", falling back to thevquery parameter for standard watch URLsYouTubeConverter.accepts()covering both URL formats and verifying non-YouTube URLs are rejectedTesting
test_youtube_converter_acceptsadded totest_module_misc.py