fix(editor): Allow custom git repo urls in source control settings (#10849)

This commit is contained in:
Csaba Tuncsik 2024-09-17 13:39:13 +02:00 committed by GitHub
parent d81e72b6c7
commit a63a9b53f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -170,6 +170,8 @@ describe('SettingsSourceControl', () => {
['git@192.168.1.101:2222:user/repo', true], ['git@192.168.1.101:2222:user/repo', true],
['git@ssh.dev.azure.com:v3/User/repo/directory', true], ['git@ssh.dev.azure.com:v3/User/repo/directory', true],
['ssh://git@mydomain.example:2224/gitolite-admin', true], ['ssh://git@mydomain.example:2224/gitolite-admin', true],
['gituser@192.168.1.1:ABC/Repo4.git', true],
['root@192.168.1.1/repo.git', true],
['http://github.com/user/repository', false], ['http://github.com/user/repository', false],
['https://github.com/user/repository', false], ['https://github.com/user/repository', false],
])('%s', async (url: string, isValid: boolean) => { ])('%s', async (url: string, isValid: boolean) => {

View file

@ -131,7 +131,7 @@ const repoUrlValidationRules: Array<Rule | RuleGroup> = [
name: 'MATCH_REGEX', name: 'MATCH_REGEX',
config: { config: {
regex: regex:
/^(ssh:\/\/)?git@(?:\[[0-9a-fA-F:]+\]|(?:[a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+)(?::[0-9]+)*:(?:v[0-9]+\/)?[a-zA-Z0-9_.\-\/]+(\.git)?(?:\/[a-zA-Z0-9_.\-\/]+)*$/, /^(?:git@|ssh:\/\/git@|[\w-]+@)(?:[\w.-]+|\[[0-9a-fA-F:]+])(?::\d+)?[:\/][\w\-~]+(?:\/[\w\-~]+)*(?:\.git)?(?:\/.*)?$/,
message: locale.baseText('settings.sourceControl.repoUrlInvalid'), message: locale.baseText('settings.sourceControl.repoUrlInvalid'),
}, },
}, },