The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 19:30 UTC
fix(shared): Azure DevOps repositories with a space in the name list their pull requests (#22782)
Pavel Kroupa committed
Oct 22, 2026 at 00:14 UTC
855db968a7517914019d77e3c364fe2002f345d9
2 files changed
+24
-2
packages/shared/src/sourceControl.test.ts
+11
@@ -149,6 +149,17 @@ it("names an Azure DevOps repository by its own name, not its project path", ()
149
expect(selector).toBe("checkout");
150
});
151
152
+it("decodes an Azure DevOps repository name that the remote URL percent-encodes", () => {
153
+ // A remote spells a space as `%20`, and `az repos pr list --repository` reads that literally.
154
+ const selector = sourceControlRepositorySelector({
155
+ provider: "azure-devops",
156
+ displayName: "contoso/payments%20(eu)/_git/checkout%20(eu)",
157
+ owner: "contoso",
158
+ name: "checkout%20(eu)",
159
+ });
160
+ expect(selector).toBe("checkout (eu)");
161
+});
162
+
163
it("keeps a GitLab identity's whole path, because a nested group is part of the name", () => {
164
const selector = sourceControlRepositorySelector({
165
provider: "gitlab",
packages/shared/src/sourceControl.ts
+13
-2
@@ -278,11 +278,21 @@ export function detectSourceControlProviderFromRemoteUrl(
278
};
279
}
280
281
+function decodeUrlPathSegment(segment: string): string {
282
+ try {
283
+ return decodeURIComponent(segment);
284
+ } catch {
285
+ return segment;
286
+ }
287
+}
288
+
289
/**
290
* Azure DevOps is the exception: `az repos pr list --repository` takes a repository name, and
291
* takes the organisation and project from the checkout it detects — so the recorded
292
* `org/project/_git/repo` path is refused outright and the whole repository reads as
285
- * unavailable. Its name is the last segment, which is what this hands over.
293
+ * unavailable. Its name is the last segment, which is what this hands over. The segment comes
294
+ * from the remote URL, where a name with a space reads `my%20repo`; `az` looks that up literally
295
+ * and answers 404, so it goes out decoded.
296
*/
297
export function sourceControlRepositorySelector(
298
identity:
@@ -293,7 +303,8 @@ export function sourceControlRepositorySelector(
303
if (!identity) return null;
304
if (identity.provider === "azure-devops") {
305
const segments = (identity.displayName ?? "").split("/").filter((part) => part !== "_git");
296
- return identity.name || segments.at(-1) || null;
306
+ const name = identity.name || segments.at(-1);
307
+ return name ? decodeUrlPathSegment(name) : null;
308
}
309
if (identity.displayName) return identity.displayName;
310
return identity.owner && identity.name ? `${identity.owner}/${identity.name}` : null;