diff --git a/packages/server/src/routes/api.ts b/packages/server/src/routes/api.ts index 1684a9b773..800f0856e0 100644 --- a/packages/server/src/routes/api.ts +++ b/packages/server/src/routes/api.ts @@ -42,6 +42,7 @@ import { checkForUpdate, BUNDLED_IS_BINARY, BUNDLED_VERSION, + parseOwnerRepo, } from '@archon/paths'; import { discoverWorkflowsWithConfig } from '@archon/workflows/workflow-discovery'; import { parseWorkflow } from '@archon/workflows/loader'; @@ -2402,12 +2403,12 @@ export function registerApiRoutes( getLog().error({ runId, codebaseId: run.codebase_id }, 'artifacts.codebase_lookup_failed'); return apiError(c, 404, 'Artifact not available: codebase not found'); } - const nameParts = codebase.name.split('/'); - if (nameParts.length < 2) { + const parsed = parseOwnerRepo(codebase.name); + if (!parsed) { getLog().error({ runId, codebaseName: codebase.name }, 'artifacts.owner_repo_parse_failed'); return apiError(c, 404, 'Artifact not available: could not determine owner/repo'); } - const [owner, repo] = nameParts; + const { owner, repo } = parsed; const artifactDir = getRunArtifactsPath(owner, repo, runId); const filePath = join(artifactDir, filename);