fix: skip renaming imported repository

This commit is contained in:
Nicolas Meienberger
2025-11-26 22:20:42 +01:00
parent bedd325a60
commit 4328607cc1
2 changed files with 14 additions and 0 deletions

View File

@@ -99,6 +99,11 @@ const migrateRepositoryFolders = async (): Promise<MigrationResult> => {
const config = repo.config as Extract<RepositoryConfig, { backend: "local" }>;
if (config.isExistingRepository) {
logger.debug(`Skipping imported repository "${repo.name}" - folder path is user-defined`);
continue;
}
if (config.name === repo.shortId) {
continue;
}

View File

@@ -367,6 +367,15 @@ const updateRepository = async (name: string, updates: { name?: string; compress
throw new NotFoundError("Repository not found");
}
if (
updates.name !== undefined &&
updates.name !== existing.name &&
existing.config.backend === "local" &&
existing.config.isExistingRepository
) {
throw new ConflictError("Cannot rename an imported local repository");
}
let newName = existing.name;
if (updates.name !== undefined && updates.name !== existing.name) {
const newSlug = slugify(updates.name, { lower: true, strict: true });