1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-04 17:47:19 +00:00

Fix some migration and repo name problems (#33986)

1. Ignore empty inputs in `UnmarshalHandleDoubleEncode`
2. Ignore non-existing `stateEvent.User` in gitlab migration
3. Enable `release` and `wiki` units when they are selected in migration
4. Sanitize repo name for migration and new repo
This commit is contained in:
wxiaoguang
2025-03-25 11:26:58 +08:00
committed by GitHub
parent 536f4c6de8
commit 51d86adb6d
12 changed files with 123 additions and 31 deletions

View File

@ -1,4 +1,5 @@
import {hideElem, showElem, toggleElem} from '../utils/dom.ts';
import {sanitizeRepoName} from './repo-common.ts';
const service = document.querySelector<HTMLInputElement>('#service_type');
const user = document.querySelector<HTMLInputElement>('#auth_username');
@ -25,13 +26,19 @@ export function initRepoMigration() {
});
lfs?.addEventListener('change', setLFSSettingsVisibility);
const cloneAddr = document.querySelector<HTMLInputElement>('#clone_addr');
cloneAddr?.addEventListener('change', () => {
const repoName = document.querySelector<HTMLInputElement>('#repo_name');
if (cloneAddr.value && !repoName?.value) { // Only modify if repo_name input is blank
repoName.value = /^(.*\/)?((.+?)(\.git)?)$/.exec(cloneAddr.value)[3];
}
});
const elCloneAddr = document.querySelector<HTMLInputElement>('#clone_addr');
const elRepoName = document.querySelector<HTMLInputElement>('#repo_name');
if (elCloneAddr && elRepoName) {
let repoNameChanged = false;
elRepoName.addEventListener('input', () => {repoNameChanged = true});
elCloneAddr.addEventListener('input', () => {
if (repoNameChanged) return;
let repoNameFromUrl = elCloneAddr.value.split(/[?#]/)[0];
repoNameFromUrl = /^(.*\/)?((.+?)\/?)$/.exec(repoNameFromUrl)[3];
repoNameFromUrl = repoNameFromUrl.split(/[?#]/)[0];
elRepoName.value = sanitizeRepoName(repoNameFromUrl);
});
}
}
function checkAuth() {