MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / parseGitlabZipPath

Function parseGitlabZipPath

website/api/gitlab-zip.ts:5–22  ·  view source on GitHub ↗
(urlPath: string)

Source from the content-addressed store, hash-verified

3import https from "https";
4
5function parseGitlabZipPath(urlPath: string): { project: string; branch: string } | null {
6 const segments = urlPath.split("/").filter(Boolean);
7 // /api/gitlab-zip/:encodedProject/:branch
8 if (segments.length < 4 || segments[0] !== "api" || segments[1] !== "gitlab-zip") {
9 return null;
10 }
11 const encodedProject = segments[2];
12 const branch = segments[3];
13 if (!encodedProject || !branch) return null;
14
15 let project = encodedProject;
16 try {
17 project = decodeURIComponent(encodedProject);
18 } catch {
19 project = encodedProject;
20 }
21 return { project, branch };
22}
23
24function fetchGitlabArchive(project: string, branch: string, token?: string): Promise<{
25 statusCode: number;

Callers 1

handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected