From a63a9b53f06d3a00e8e76c0ab9f2571604c01922 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Tue, 17 Sep 2024 13:39:13 +0200 Subject: [PATCH] fix(editor): Allow custom git repo urls in source control settings (#10849) --- .../src/views/{__tests__ => }/SettingsSourceControl.test.ts | 2 ++ packages/editor-ui/src/views/SettingsSourceControl.vue | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) rename packages/editor-ui/src/views/{__tests__ => }/SettingsSourceControl.test.ts (98%) diff --git a/packages/editor-ui/src/views/__tests__/SettingsSourceControl.test.ts b/packages/editor-ui/src/views/SettingsSourceControl.test.ts similarity index 98% rename from packages/editor-ui/src/views/__tests__/SettingsSourceControl.test.ts rename to packages/editor-ui/src/views/SettingsSourceControl.test.ts index aa0a100e4e..3cc3072e86 100644 --- a/packages/editor-ui/src/views/__tests__/SettingsSourceControl.test.ts +++ b/packages/editor-ui/src/views/SettingsSourceControl.test.ts @@ -170,6 +170,8 @@ describe('SettingsSourceControl', () => { ['git@192.168.1.101:2222:user/repo', true], ['git@ssh.dev.azure.com:v3/User/repo/directory', 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], ['https://github.com/user/repository', false], ])('%s', async (url: string, isValid: boolean) => { diff --git a/packages/editor-ui/src/views/SettingsSourceControl.vue b/packages/editor-ui/src/views/SettingsSourceControl.vue index c8c9263b6f..23505092da 100644 --- a/packages/editor-ui/src/views/SettingsSourceControl.vue +++ b/packages/editor-ui/src/views/SettingsSourceControl.vue @@ -131,7 +131,7 @@ const repoUrlValidationRules: Array = [ name: 'MATCH_REGEX', config: { 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'), }, },