diff options
author | HampusM <hampus@hampusmat.com> | 2021-06-11 18:57:41 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-06-11 18:57:41 +0200 |
commit | 5b72b479ba3acf391a61a2c04ca694e30d108565 (patch) | |
tree | ccc1f681fb39e8b6d0e15a5d6125465c63fc484c /packages/server/src/api/util.ts | |
parent | 7e9433762f51be2c4938481c9c33589982118033 (diff) |
Backend is fully in typescript now
Diffstat (limited to 'packages/server/src/api/util.ts')
-rw-r--r-- | packages/server/src/api/util.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/server/src/api/util.ts b/packages/server/src/api/util.ts index e4a7d17..72c8992 100644 --- a/packages/server/src/api/util.ts +++ b/packages/server/src/api/util.ts @@ -1,4 +1,4 @@ -import { Git, GitRequestInfo } from "./git"; +import { Git, GitAPI } from "./git"; import { readdir } from "fs"; type VerificationResultErrorType = "REPO_NOT_FOUND" | "REPO_INVALID" | "COMMIT_NOT_FOUND" | "COMMIT_INVALID" | "ACCESS_DENIED"; @@ -22,7 +22,7 @@ export class VerificationResult { } success: boolean; - code: number | null = null; + code: number = 0; message: string | null = null; } @@ -35,7 +35,7 @@ export function verifyRepoName(base_dir: string, repo_name: string) { return; } - readdir(base_dir, (err: Error, dir_content: string[]) => { + readdir(base_dir, (err, dir_content) => { if(err) { resolve(new VerificationResult(false, "REPO_NOT_FOUND")); return; @@ -52,7 +52,7 @@ export function verifyRepoName(base_dir: string, repo_name: string) { }); } -export async function verifyCommitID(git: Git, repo: string, commit_id: string) { +export async function verifyCommitID(git: GitAPI, repo: string, commit_id: string) { if(!(/^[a-fA-F0-9]+$/u).test(commit_id)) { return new VerificationResult(false, "COMMIT_INVALID"); } @@ -66,7 +66,7 @@ export async function verifyCommitID(git: Git, repo: string, commit_id: string) return new VerificationResult(true); } -export function verifyGitRequest(request_info: GitRequestInfo): VerificationResult { +export function verifyGitRequest(request_info: Git.RequestInfo): VerificationResult { if((/\.\/|\.\./u).test(request_info.parsed_url.pathname)) { return new VerificationResult(false, "REPO_NOT_FOUND"); } |