Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ describe('SettingsSourceControl', () => {
['[email protected]:2222:user/repo', true],
['[email protected]:v3/User/repo/directory', true],
['ssh://[email protected]:2224/gitolite-admin', true],
['[email protected]:ABC/Repo4.git', true],
['[email protected]/repo.git', true],
['http://github.com/user/repository', false],
['https://github.com/user/repository', false],
])('%s', async (url: string, isValid: boolean) => {
Expand All @@ -180,7 +182,8 @@ describe('SettingsSourceControl', () => {

await waitFor(() => expect(sourceControlStore.preferences.publicKey).not.toEqual(''));

const repoUrlInput = container.querySelector('input[name="repoUrl"]')!;
const repoUrlInput = container.querySelector('input[name="repoUrl"]');
expect(repoUrlInput).toBeInTheDocument();

await userEvent.click(repoUrlInput);
await userEvent.type(repoUrlInput, url);
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/views/SettingsSourceControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const repoUrlValidationRules: Array<Rule | RuleGroup> = [
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'),
},
},
Expand Down
Loading