From 4c496de2a2789db268923c536e3ffc1ceaa1face Mon Sep 17 00:00:00 2001 From: Ferruh Cihan <63190600+ferruhcihan@users.noreply.github.com> Date: Wed, 15 Oct 2025 13:54:58 +0200 Subject: [PATCH] fix: create build repo url validation --- .../create-edit/create-edit-builds.validator.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/builds/create-edit/create-edit-builds.validator.ts b/src/pages/builds/create-edit/create-edit-builds.validator.ts index 8eb0c34b2..fda46e7b4 100644 --- a/src/pages/builds/create-edit/create-edit-builds.validator.ts +++ b/src/pages/builds/create-edit/create-edit-builds.validator.ts @@ -8,7 +8,16 @@ const envVarSchema = object({ }) const commonModeSchema = object({ - repoUrl: string().required('Repository URL is required').url('Invalid repository URL'), + repoUrl: string() + .required('Repository URL is required') + .test('is-valid-git-url', 'Invalid repository URL', (value) => { + if (!value) return false + // Check for SSH format: git@host:path or user@host:path + const sshPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+:[a-zA-Z0-9/._-]+$/ + // Check for HTTP(S) URL format + const httpPattern = /^https?:\/\/.+/ + return sshPattern.test(value) || httpPattern.test(value) + }), path: string().optional(), revision: string().optional(), envVars: array().of(envVarSchema).optional(),