Don't put trailing slash in autogenerated name during import

During import process, if I paste in the valid GitHub clone
URL https://github.com/yuvipanda/notebooksharing.space/, the form
automatically generates an invalid forgejo repo name including the
trailing slash. This commit changes the regex used to generate this
to optionally ignore the trailing slash - it was already ignoring
the optional trailing `.git`.
This commit is contained in:
YuviPanda 2025-03-22 12:10:37 -07:00
parent 8df8381f51
commit f2a1dbf9cd

View file

@ -29,7 +29,7 @@ export function initRepoMigration() {
cloneAddr?.addEventListener('change', () => {
const repoName = document.getElementById('repo_name');
if (cloneAddr.value && !repoName?.value) { // Only modify if repo_name input is blank
repoName.value = cloneAddr.value.match(/^(.*\/)?((.+?)(\.git)?)$/)[3];
repoName.value = cloneAddr.value.match(/^(.*\/)?((.+?)(\.git)?\/?)$/)[3];
}
});
}