@devries-cameron20 / t3code-1 / commits / 4ed4950b7c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(client): reject incomplete GitHub owner paths before lookup (#23024)

Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: maria-rcks <maria@kuuro.net>

Naveed Iqbal committed Nov 2, 2026 at 01:54 UTC 4ed4950b7cb44837725bc645433867336b3ce866
4 files changed +72
apps/mobile/src/features/projects/AddProjectScreen.tsx
+6
@@ -23,6 +23,7 @@ import {
23 getNewProjectPublishTarget,
24 getNewProjectPublishTargets,
25 getNewProjectRepository,
26 + githubIncompleteOwnerRepositoryMessage,
27 defaultHostCloneUrl,
28 normalizePastedCloneUrl,
29 parseAddProjectRemoteSource,
@@ -823,6 +824,11 @@ export function AddProjectRepositoryScreen(props: {
824
825 const lookupRepository = async () => {
826 if (!environment || repositoryInput.trim().length === 0 || isSubmitting) return;
827 + const incompleteOwnerMessage = githubIncompleteOwnerRepositoryMessage(source, repositoryInput);
828 + if (incompleteOwnerMessage) {
829 + setError(incompleteOwnerMessage);
830 + return;
831 + }
832 setError(null);
833 setIsSubmitting(true);
834 const provider = addProjectRemoteSourceProvider(source);
apps/web/src/components/CommandPalette.tsx
+16
@@ -16,6 +16,7 @@ import {
16 getNewProjectPublishTarget,
17 getNewProjectPublishTargets,
18 getNewProjectRepository,
19 + githubIncompleteOwnerRepositoryMessage,
20 normalizePastedCloneUrl,
21 addProjectRemoteSourceLabel,
22 addProjectRemoteSourcePathHint,
@@ -1940,6 +1941,21 @@ function OpenCommandPaletteDialog(props: {
1941 return;
1942 }
1943
1944 + const incompleteOwnerMessage = githubIncompleteOwnerRepositoryMessage(
1945 + addProjectCloneFlow.source,
1946 + rawRepository,
1947 + );
1948 + if (incompleteOwnerMessage) {
1949 + toastManager.add(
1950 + stackedThreadToast({
1951 + type: "error",
1952 + title: "Repository name incomplete",
1953 + description: incompleteOwnerMessage,
1954 + }),
1955 + );
1956 + return;
1957 + }
1958 +
1959 const provider = addProjectRemoteSourceProvider(addProjectCloneFlow.source);
1960 if (!provider) {
1961 const destinationPath = getCloneDestinationPath(
packages/client-runtime/src/operations/projects.test.ts
+31
@@ -6,11 +6,42 @@ import {
6 findExistingAddProject,
7 getCloneDirectoryName,
8 getDefaultCloneUrl,
9 + githubIncompleteOwnerRepositoryMessage,
10 normalizePastedCloneUrl,
11 } from "./projects.ts";
12 import type { EnvironmentProject } from "../state/models.ts";
13
14 describe("add project shared logic", () => {
15 + it("asks for a repository name when GitHub input is only an owner path", () => {
16 + const github = SourceControlProviderKind.make("github");
17 + expect(githubIncompleteOwnerRepositoryMessage(github, "pingdotgg/")).toBe(
18 + "Enter the full owner/repository name.",
19 + );
20 + expect(githubIncompleteOwnerRepositoryMessage(github, " pingdotgg// ")).toBe(
21 + "Enter the full owner/repository name.",
22 + );
23 + expect(githubIncompleteOwnerRepositoryMessage(github, "mona-cat_octo/")).toBe(
24 + "Enter the full owner/repository name.",
25 + );
26 +
27 + for (const input of [
28 + "pingdotgg/t3code",
29 + "mona-cat_octo/repo",
30 + "pingdotgg",
31 + "https://github.com/pingdotgg/t3code.git",
32 + "git@github.com:pingdotgg/t3code.git",
33 + ]) {
34 + expect(githubIncompleteOwnerRepositoryMessage(github, input)).toBeNull();
35 + }
36 + expect(
37 + githubIncompleteOwnerRepositoryMessage(SourceControlProviderKind.make("gitlab"), "group/"),
38 + ).toBeNull();
39 + expect(githubIncompleteOwnerRepositoryMessage("url", "owner/")).toBeNull();
40 + expect(
41 + githubIncompleteOwnerRepositoryMessage(SourceControlProviderKind.make("forgejo"), "owner/"),
42 + ).toBeNull();
43 + });
44 +
45 it("routes owner/repository shorthand to GitHub over HTTPS", () => {
46 expect(normalizePastedCloneUrl("imputnet/helium")).toBe(
47 "https://github.com/imputnet/helium.git",
packages/client-runtime/src/operations/projects.ts
+19
@@ -106,6 +106,25 @@ export function defaultHostCloneUrl(repository: string): string | null {
106 : `git@${definition.publicHost}:${path}`;
107 }
108
109 +/** Owner present, repository name missing: `owner/` or `owner//`. */
110 +const INCOMPLETE_GITHUB_OWNER_PATH = /^[A-Za-z0-9](?:[A-Za-z0-9_-]{0,38})\/+$/;
111 +
112 +const INCOMPLETE_GITHUB_OWNER_REPOSITORY_MESSAGE = "Enter the full owner/repository name.";
113 +
114 +/**
115 + * Message to show when a GitHub add-project field is only `owner/`.
116 + * Lookup would send that to GitHub and come back as a generic failure.
117 + * Returns null for complete names, bare repo names, URLs, and other sources.
118 + */
119 +export function githubIncompleteOwnerRepositoryMessage(
120 + source: AddProjectRemoteSource,
121 + input: string,
122 +): string | null {
123 + if (source !== "github") return null;
124 + if (!INCOMPLETE_GITHUB_OWNER_PATH.test(input.trim())) return null;
125 + return INCOMPLETE_GITHUB_OWNER_REPOSITORY_MESSAGE;
126 +}
127 +
128 export function normalizePastedCloneUrl(input: string): string {
129 const trimmed = input.trim();
130 return REPOSITORY_SHORTHAND.test(trimmed) ? (defaultHostCloneUrl(trimmed) ?? trimmed) : trimmed;