fix: verwaiste Projekte archivierbar (Gitea-Repo 404 nicht mehr hart abbrechen)
- archiveRepo: fehlt das Gitea-Repo (404), wird nur das Appwrite-Dokument (ent)archiviert statt hart zu scheitern -> orphaned Projekte lassen sich aus der Liste entfernen - Reaktivierungs-Redeploy wird bei fehlendem Repo uebersprungen Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -482,13 +482,21 @@ export async function archiveRepo(projectId, archived = true) {
|
||||
}
|
||||
|
||||
const repoFullName = doc.repoFullName || ''
|
||||
let repoMissing = false
|
||||
if (repoFullName.includes('/')) {
|
||||
try {
|
||||
await patchGiteaRepo(repoFullName, { archived: Boolean(archived) })
|
||||
} catch (err) {
|
||||
const error = new Error('Gitea-Archivierung fehlgeschlagen: ' + err.message)
|
||||
error.status = err.status || 500
|
||||
throw error
|
||||
// Verwaistes Projekt: Repo existiert nicht mehr in Gitea (404). Dann trotzdem
|
||||
// nur das Appwrite-Dokument (ent)archivieren, damit es aus der Liste verschwindet.
|
||||
if (err.status === 404) {
|
||||
repoMissing = true
|
||||
console.warn(`[archiveRepo] Gitea-Repo ${repoFullName} nicht gefunden (404) - nur Appwrite wird aktualisiert`)
|
||||
} else {
|
||||
const error = new Error('Gitea-Archivierung fehlgeschlagen: ' + err.message)
|
||||
error.status = err.status || 500
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,7 +506,7 @@ export async function archiveRepo(projectId, archived = true) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!archived && doc.subdomain) {
|
||||
if (!archived && !repoMissing && doc.subdomain) {
|
||||
try {
|
||||
const branch = (await getRepoInfo(repoFullName))?.defaultBranch || 'main'
|
||||
const cfg = (await fetchPreviewConfig(repoFullName, branch)) || {
|
||||
|
||||
Reference in New Issue
Block a user