mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-15 22:48:00 +02:00
fix bugs and report better errors
This commit is contained in:
@@ -304,6 +304,7 @@ router.get("/:repoId/", async (req: express.Request, res: express.Response) => {
|
||||
function validateNewRepo(repoUpdate: any): void {
|
||||
const validCharacters = /^[0-9a-zA-Z\-_]+$/;
|
||||
if (
|
||||
typeof repoUpdate.repoId !== "string" ||
|
||||
!repoUpdate.repoId.match(validCharacters) ||
|
||||
repoUpdate.repoId.length < 3
|
||||
) {
|
||||
@@ -312,6 +313,12 @@ function validateNewRepo(repoUpdate: any): void {
|
||||
httpStatus: 400,
|
||||
});
|
||||
}
|
||||
if (!repoUpdate.source) {
|
||||
throw new AnonymousError("source_not_provided", {
|
||||
object: repoUpdate,
|
||||
httpStatus: 400,
|
||||
});
|
||||
}
|
||||
if (!repoUpdate.source.branch) {
|
||||
throw new AnonymousError("branch_not_specified", {
|
||||
object: repoUpdate,
|
||||
|
||||
Reference in New Issue
Block a user