loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: ignore trailing slash for autogenerated name (#7307)

- During the migration process, if a valid GitHub clone URL was pasted, https://github.com/yuvipanda/notebooksharing.space/, the form automatically generates an invalid Forgejo repository name that included the trailing slash.
- Change the regex used to generate the name to ignore the trailing slash.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7307
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: YuviPanda <yuvipanda@gmail.com>
Co-committed-by: YuviPanda <yuvipanda@gmail.com>

authored by

YuviPanda
YuviPanda
and committed by
Gusted
c9853e9e 8df8381f

+29 -1
+28
tests/e2e/repo-migrate.test.e2e.ts
··· 7 7 8 8 test.use({user: 'user2'}); 9 9 10 + test('Migration Repo Name detection', async ({page}, workerInfo) => { 11 + test.skip(workerInfo.project.name === 'Mobile Safari', 'Flaky actionability checks on Mobile Safari'); 12 + 13 + await page.goto('/repo/migrate?service_type=2'); 14 + 15 + const form = page.locator('form'); 16 + 17 + // Test trailing slashes are stripped 18 + await form.getByRole('textbox', {name: 'Migrate / Clone from URL'}).fill('https://github.com/example/test/'); 19 + await form.getByRole('textbox', {name: 'Migrate / Clone from URL'}).blur(); 20 + await expect(form.getByRole('textbox', {name: 'Repository Name'})).toHaveValue('test'); 21 + 22 + // Test trailing .git is stripped 23 + await page.reload(); 24 + await form.getByRole('textbox', {name: 'Migrate / Clone from URL'}).fill('https://github.com/example/test.git'); 25 + await form.getByRole('textbox', {name: 'Migrate / Clone from URL'}).blur(); 26 + await expect(form.getByRole('textbox', {name: 'Repository Name'})).toHaveValue('test'); 27 + 28 + // Test trailing .git and trailing / together is stripped 29 + await page.reload(); 30 + await form.getByRole('textbox', {name: 'Migrate / Clone from URL'}).fill('https://github.com/example/test.git/'); 31 + await form.getByRole('textbox', {name: 'Migrate / Clone from URL'}).blur(); 32 + await expect(form.getByRole('textbox', {name: 'Repository Name'})).toHaveValue('test'); 33 + 34 + // Save screenshot only once 35 + await save_visual(page); 36 + }); 37 + 10 38 test('Migration Progress Page', async ({page, browser}, workerInfo) => { 11 39 test.skip(workerInfo.project.name === 'Mobile Safari', 'Flaky actionability checks on Mobile Safari'); 12 40
+1 -1
web_src/js/features/repo-migration.js
··· 29 29 cloneAddr?.addEventListener('change', () => { 30 30 const repoName = document.getElementById('repo_name'); 31 31 if (cloneAddr.value && !repoName?.value) { // Only modify if repo_name input is blank 32 - repoName.value = cloneAddr.value.match(/^(.*\/)?((.+?)(\.git)?)$/)[3]; 32 + repoName.value = cloneAddr.value.match(/^(.*\/)?((.+?)(\.git)?\/?)$/)[3]; 33 33 } 34 34 }); 35 35 }