fix(backend): decode percent-encoded characters in generic git URL repo names

Merged
TY
1mo ago
+43-1

Fixes #1384.

Direct-URL generic git configs built the repo name from the raw percent-encoded pathname, while the file-based path already decodes it. This reuses the same decodeURIComponent approach so both paths produce consistent names and zoekt metadata.

Verified: added a regression test with a %20 URL. It fails on main (name keeps %20) and passes with this change. Backend vitest suite for repoCompileUtils (15 tests) and tsc build pass in Docker (node:24-bookworm).


[!NOTE]
Medium Risk
Changes canonical repo identity for direct generic git URLs on re-sync, which can affect indexing, search filters, and Zoekt shard naming for affected deployments.

Overview
Fixes inconsistent repository naming for direct HTTP(S) generic git connection URLs by decoding percent-encoded path segments (e.g. %20 → spaces) when building name, displayName, and Zoekt gitConfig metadata—matching behavior the file-based generic git path already had.

Malformed percent-encoding in a URL now skips that target and records an INVALID_REPOSITORY_SOURCE discovery issue instead of failing compilation. A regression test covers spaced repo names in URLs, and the changelog is updated.

Note: Repos that were previously registered with literal %20 in the name may appear under a new name after the next connection sync.

Reviewed by Cursor Bugbot for commit a784620473e52c43816181c1fc64dbc2876d1f4a. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Fixes #1384 by decoding percent-encoded characters (like %20) in repo names for direct-URL generic git configs, so they match the file-based path and zoekt metadata. Malformed URL encodings now skip the URL with an INVALID_REPOSITORY_SOURCE discovery issue instead of failing the whole compile.

  • Adds a regression test for a %20 URL.
  • Adds a CHANGELOG entry.

Existing repos with literal %20 in their names could rename on re-sync.

Summary by CodeRabbit

  • Bug Fixes
    • Repository names from direct generic Git URLs now correctly decode percent-encoded characters, such as spaces, and display the decoded names consistently in repository details and Git metadata.
    • URLs with malformed percent-encoding are skipped and reported as invalid repository sources, rather than interrupting repository processing.