mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 19:21:36 +00:00
fix(validation): update git:// URL validation to support port numbers and tilde characters in paths
This commit is contained in:
@@ -142,8 +142,8 @@ class ValidGitRepositoryUrl implements ValidationRule
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} elseif (str_starts_with($value, 'git://')) {
|
} elseif (str_starts_with($value, 'git://')) {
|
||||||
// Validate git:// protocol URL
|
// Validate git:// protocol URL (supports both git://host/path and git://host:port/path with tilde)
|
||||||
if (! preg_match('/^git:\/\/[a-zA-Z0-9\.\-]+\/[a-zA-Z0-9\-_\/\.]+$/', $value)) {
|
if (! preg_match('/^git:\/\/[a-zA-Z0-9\.\-]+(:[0-9]+)?[:\/][a-zA-Z0-9\-_\/\.~]+$/', $value)) {
|
||||||
$fail('The :attribute is not a valid git:// URL.');
|
$fail('The :attribute is not a valid git:// URL.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ it('validates git:// protocol URLs', function () {
|
|||||||
$validUrls = [
|
$validUrls = [
|
||||||
'git://github.com/user/repo.git',
|
'git://github.com/user/repo.git',
|
||||||
'git://gitlab.com/user/repo.git',
|
'git://gitlab.com/user/repo.git',
|
||||||
|
'git://git.sr.ht:~user/repo.git',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($validUrls as $url) {
|
foreach ($validUrls as $url) {
|
||||||
|
|||||||
Reference in New Issue
Block a user