Repository navigation
Keep the case of custom API URLs (translate, TTS, STT) - #1207
Merged
jianchang512 merged 1 commit intoSep 14, 2026
Merged
Conversation
The custom translation, TTS and STT channels lowercased the whole URL the user typed, so a case-sensitive path or a token in the query string was sent altered. Only compare the scheme and the /api suffix case-insensitively, as recognapi already does since 9a256da.
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.
While reading 9a256da I noticed that the custom recognition API (
_recognapi.py) stopped lowercasing the URL the user types, and now only compares the scheme case-insensitively. Three sibling channels still have the old line:videotrans/translator/_transapi.py(trans_api_url)videotrans/tts/_ttsapi.py(ttsapi_url)videotrans/recognition/_stt.py(stt_url)Each one does
.strip().rstrip('/').lower()on the whole address, so a case-sensitive path or a token in the query string is sent altered. For examplehttps://example.com/Translate?token=AbCbecomeshttps://example.com/translate?token=abc, and_transapi.pyexplicitly supports a?in the URL, which is where a key usually goes.I applied the same change as in
_recognapi.py: the URL keeps its case, and only thehttpcheck (plus the/apisuffix check in_stt.py) uses.lower(), soHTTP://...and.../APIare still recognised as before.I added
tests/test_custom_api_url.py, which builds each channel fromparamsand checksapi_url. On main, 5 of the 6 tests fail with the lowercased URL, and all 6 pass with this change. On the rest of the suite, the before/after runs differ by exactly those 5 tests. I ran it without the GUI dependencies, so some unrelated tests fail in both runs.AI tools used