fix(backend): decode percent-encoded repo names for generic Git URLs#1415
Closed
rachit367 wants to merge 2 commits into
Closed
fix(backend): decode percent-encoded repo names for generic Git URLs#1415rachit367 wants to merge 2 commits into
rachit367 wants to merge 2 commits into
Conversation
compileGenericGitHostConfig_url derived the repo name from the raw remoteUrl.pathname, so a direct URL like .../Project%20Name.git kept %20 in name, displayName and zoekt metadata. The file-based path already decodes via decodeURIComponent, so the same remote produced inconsistent identifiers depending on how it was configured. Decode the pathname to match. Fixes sourcebot-dev#1384
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Author
|
Closing in favor of #1389, which predates this (opened 2026-06-29) and fixes the same issue more completely — it wraps the decode in a helper that preserves malformed percent-escapes (e.g. |
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 #1384
Problem
A generic Git connection pointing directly at an HTTP(S) remote whose path contains encoded characters (e.g.
https://github.com/test/Project%20Name%20With%20Spaces.git) stores the repo name with the encoding intact —github.com/test/Project%20Name%20With%20Spaces— inname,displayName, and the zoekt metadata.compileGenericGitHostConfig_urlderives the name fromremoteUrl.pathnamewithout decoding, while the file-origin path (compileGenericGitHostConfig_file) already callsdecodeURIComponent. So the same remote produces different Sourcebot/zoekt identifiers depending on whether it's configured as a direct URL or discovered from a local repository origin.(Re: @brendan-kellam's question on the issue — that inconsistency across the two code paths is the concrete impact.)
Fix
Decode
remoteUrl.pathnameincompileGenericGitHostConfig_urlbefore building the name, mirroring the existing file-origin behavior.Tests
Added a
compileGenericGitHostConfig_urlcase asserting a%20-encoded URL yieldsgithub.com/test/Project Name With Spacesinname,displayName, andzoekt.name— matching the existing_filetest.tsc --noEmitis clean for the backend package.(Note: the repo's generic-git
_urltests assert forward-slash-joined names and only pass on POSIX CI, sincepath.joinuses the platform separator; they fail identically on Windows before this change. The decode logic itself is platform-independent.)