⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
fix(gitea): classify /user 404 as not-a-gitea-instance
justin364f5e373ea8
diff --git a/apps/api/src/gitea-integration/controllers/verify-gitea-access.ts b/apps/api/src/gitea-integration/controllers/verify-gitea-access.tsindex fba7adff0..ce5f2822b 100644--- a/apps/api/src/gitea-integration/controllers/verify-gitea-access.ts+++ b/apps/api/src/gitea-integration/controllers/verify-gitea-access.ts@@ -19,7 +19,25 @@ async function verifyGiteaAccess({}) {try {const normalized = normalizeGiteaBaseUrl(baseUrl);- await verifyGiteaToken(normalized, accessToken);+ try {+ await verifyGiteaToken(normalized, accessToken);+ } catch (error) {+ // A 404 from /user means the URL does not point at a Gitea instance+ // (or the token endpoint is misrouted), not a repository lookup+ // failure. Treat it like any other non-Gitea-instance signal.+ if (error instanceof GiteaApiError && error.status === 404) {+ return {+ isInstalled: false,+ hasRequiredPermissions: false,+ repositoryExists: false,+ repositoryPrivate: null,+ missingPermissions: [] as string[],+ message: "The URL does not point to a Gitea instance.",+ failureReason: "not_a_gitea_instance",+ };+ }+ throw error;+ }const client = createGiteaClient({baseUrl: normalized,diff --git a/i18n/de-DE.json b/i18n/de-DE.jsonindex 9204b3cc9..e83136d52 100644--- a/i18n/de-DE.json+++ b/i18n/de-DE.json@@ -783,8 +783,8 @@"settingsUpdateError": "Gitea-Integration konnte nicht aktualisiert werden","secretCopied": "Kopiert","unableToCopySecret": "Geheimnis konnte nicht kopiert werden",- "notGiteaInstance": "The URL does not point to a Gitea instance",- "redirected": "Gitea URL redirected (usually to HTTPS). Use the final URL directly."+ "notGiteaInstance": "Die URL verweist nicht auf eine Gitea-Instanz",+ "redirected": "Gitea-URL wurde weitergeleitet (normalerweise zu HTTPS). Verwende die endgültige URL direkt."},"webhookShow": "Anzeigen","webhookHide": "Ausblenden",diff --git a/i18n/el-GR.json b/i18n/el-GR.jsonindex 5cb747f6a..4bac9ec62 100644--- a/i18n/el-GR.json+++ b/i18n/el-GR.json@@ -783,8 +783,8 @@"settingsUpdateError": "Αποτυχία ενημέρωσης ενσωμάτωσης Gitea","secretCopied": "Copied","unableToCopySecret": "Δεν ήταν δυνατή η αντιγραφή του μυστικού",- "notGiteaInstance": "The URL does not point to a Gitea instance",- "redirected": "Gitea URL redirected (usually to HTTPS). Use the final URL directly."+ "notGiteaInstance": "Η διεύθυνση URL δεν οδηγεί σε παρουσία Gitea",+ "redirected": "Η διεύθυνση URL του Gitea ανακατευθύνθηκε (συνήθως σε HTTPS). Χρησιμοποιήστε απευθείας την τελική διεύθυνση."},"webhookShow": "Show","webhookHide": "Hide",diff --git a/i18n/es-ES.json b/i18n/es-ES.jsonindex e837f0cde..56afed379 100644--- a/i18n/es-ES.json+++ b/i18n/es-ES.json@@ -1130,8 +1130,8 @@"settingsUpdateError": "Error al actualizar la integración con Gitea","secretCopied": "Copiado","unableToCopySecret": "No se pudo copiar el secreto",- "notGiteaInstance": "The URL does not point to a Gitea instance",- "redirected": "Gitea URL redirected (usually to HTTPS). Use the final URL directly."+ "notGiteaInstance": "La URL no apunta a una instancia de Gitea",+ "redirected": "La URL de Gitea se ha redirigido (normalmente a HTTPS). Usa la URL final directamente."},"webhookShow": "Mostrar","webhookHide": "Ocultar",diff --git a/i18n/fr-FR.json b/i18n/fr-FR.jsonindex 7b567a7e0..6ec21ae9c 100644--- a/i18n/fr-FR.json+++ b/i18n/fr-FR.json@@ -783,8 +783,8 @@"settingsUpdateError": "Échec de la mise à jour de l'intégration Gitea","secretCopied": "Copied","unableToCopySecret": "Impossible de copier le secret",- "notGiteaInstance": "The URL does not point to a Gitea instance",- "redirected": "Gitea URL redirected (usually to HTTPS). Use the final URL directly."+ "notGiteaInstance": "L'URL ne pointe pas vers une instance Gitea",+ "redirected": "L'URL Gitea a été redirigée (généralement vers HTTPS). Utilisez directement l'URL finale."},"webhookShow": "Show","webhookHide": "Hide",diff --git a/i18n/hi-IN.json b/i18n/hi-IN.jsonindex e7203e0cb..f79d29b1f 100644--- a/i18n/hi-IN.json+++ b/i18n/hi-IN.json@@ -945,8 +945,8 @@"settingsUpdateError": "Gitea एकीकरण अपडेट करने में विफल","secretCopied": "कॉपी किया","unableToCopySecret": "सीक्रेट कॉपी करने में असमर्थ",- "notGiteaInstance": "The URL does not point to a Gitea instance",- "redirected": "Gitea URL redirected (usually to HTTPS). Use the final URL directly."+ "notGiteaInstance": "यह URL किसी Gitea इंस्टेंस की ओर इंगित नहीं करता",+ "redirected": "Gitea URL पुनः निर्देशित किया गया (आमतौर पर HTTPS पर). अंतिम URL सीधे उपयोग करें।"},"webhookShow": "दिखाएँ","webhookHide": "छिपाएँ",@@ -1505,7 +1505,7 @@"deleteTable": "तालिका हटाएँ"},"mermaid": {- "renderFailed": "Mermaid diagram couldn't be rendered"+ "renderFailed": "Mermaid डायग्राम प्रस्तुत नहीं किया जा सका"}}}@@ -1641,7 +1641,7 @@"onlyYoutubeInline": "केवल YouTube URL एम्बेड किए जा सकते हैं। इसके बजाय लिंक मोड का उपयोग करें।"},"mermaid": {- "renderFailed": "Mermaid diagram couldn't be rendered"+ "renderFailed": "Mermaid डायग्राम प्रस्तुत नहीं किया जा सका"}}},diff --git a/i18n/id-ID.json b/i18n/id-ID.jsonindex 81353a20b..65b08ef39 100644--- a/i18n/id-ID.json+++ b/i18n/id-ID.json@@ -783,8 +783,8 @@"settingsUpdateError": "Gagal memperbarui integrasi Gitea","secretCopied": "Disalin","unableToCopySecret": "Tidak dapat menyalin rahasia",- "notGiteaInstance": "The URL does not point to a Gitea instance",- "redirected": "Gitea URL redirected (usually to HTTPS). Use the final URL directly."+ "notGiteaInstance": "URL tidak menunjuk ke instance Gitea",+ "redirected": "URL Gitea dialihkan (biasanya ke HTTPS). Gunakan URL akhir secara langsung."},"webhookShow": "Tampilkan","webhookHide": "Sembunyikan",diff --git a/i18n/it-IT.json b/i18n/it-IT.jsonindex 2589d2b2b..b3b9d2631 100644--- a/i18n/it-IT.json+++ b/i18n/it-IT.json@@ -945,8 +945,8 @@"settingsUpdateError": "Aggiornamento integrazione Gitea fallito","secretCopied": "Copiato","unableToCopySecret": "Impossibile copiare il segreto",- "notGiteaInstance": "The URL does not point to a Gitea instance",- "redirected": "Gitea URL redirected (usually to HTTPS). Use the final URL directly."+ "notGiteaInstance": "L'URL non punta a un'istanza Gitea",+ "redirected": "L'URL di Gitea è stata reindirizzata (di solito verso HTTPS). Usa direttamente l'URL finale."},"webhookShow": "Mostra","webhookHide": "Nascondi",@@ -1505,7 +1505,7 @@"deleteTable": "Elimina tabella"},"mermaid": {- "renderFailed": "Mermaid diagram couldn't be rendered"+ "renderFailed": "Impossibile eseguire il rendering del diagramma Mermaid"}}}@@ -1641,7 +1641,7 @@"onlyYoutubeInline": "Solo gli URL YouTube possono essere incorporati. Usa invece la modalità link."},"mermaid": {- "renderFailed": "Mermaid diagram couldn't be rendered"+ "renderFailed": "Impossibile eseguire il rendering del diagramma Mermaid"}}},diff --git a/i18n/ko-KR.json b/i18n/ko-KR.jsonindex 388299ae3..8c0c17aad 100644--- a/i18n/ko-KR.json+++ b/i18n/ko-KR.json@@ -783,8 +783,8 @@"settingsUpdateError": "Gitea 연동 업데이트에 실패했습니다","secretCopied": "복사됨","unableToCopySecret": "시크릿을 복사할 수 없습니다",- "notGiteaInstance": "The URL does not point to a Gitea instance",- "redirected": "Gitea URL redirected (usually to HTTPS). Use the final URL directly."+ "notGiteaInstance": "URL이 Gitea 인스턴스를 가리키지 않습니다",+ "redirected": "Gitea URL이 리디렉션되었습니다(보통 HTTPS로). 최종 URL을 직접 사용하세요."},"webhookShow": "표시","webhookHide": "숨기기",diff --git a/tests/api/gitea-integration/verify-gitea-access-fetch.test.ts b/tests/api/gitea-integration/verify-gitea-access-fetch.test.tsindex b25171939..af66e46a4 100644--- a/tests/api/gitea-integration/verify-gitea-access-fetch.test.ts+++ b/tests/api/gitea-integration/verify-gitea-access-fetch.test.ts@@ -137,7 +137,7 @@ describe("verifyGiteaAccess — fetch integration", () => {);});- it("returns the repository-not-found message when /user responds with 404", async () => {+ it("returns the not-a-gitea-instance message when /user responds with 404", async () => {const fetchMock = vi.fn().mockResolvedValue(makeResponse(404, "Not Found"));vi.stubGlobal("fetch", fetchMock as unknown as typeof fetch);@@ -149,9 +149,7 @@ describe("verifyGiteaAccess — fetch integration", () => {});expect(result.isInstalled).toBe(false);- expect(result.failureReason).toBe("repository_not_found");- expect(result.message).toBe(- "Repository not found or not accessible with this token.",- );+ expect(result.failureReason).toBe("not_a_gitea_instance");+ expect(result.message).toBe("The URL does not point to a Gitea instance.");});});