diff --git a/ExpressAPI/src/routes/ExerciseRoutes.ts b/ExpressAPI/src/routes/ExerciseRoutes.ts index 5137daaa404bf9ddbe0f98d93ba6af11d69ab4cb..022c91698902e30ccad4e4f693d37905834ef84d 100644 --- a/ExpressAPI/src/routes/ExerciseRoutes.ts +++ b/ExpressAPI/src/routes/ExerciseRoutes.ts @@ -24,6 +24,7 @@ import GlobalHelper from '../helpers/GlobalHelper.js'; import { IFileDirStat } from '../shared/helpers/recursiveFilesStats/RecursiveFilesStats.js'; import ExerciseManager from '../managers/ExerciseManager.js'; import * as Gitlab from '@gitbeaker/rest'; +import { ProjectSchema } from '@gitbeaker/rest'; import GitlabTreeFileType from '../shared/types/Gitlab/GitlabTreeFileType.js'; import { GitbeakerRequestError } from '@gitbeaker/requester-utils'; @@ -110,7 +111,10 @@ class ExerciseRoutes implements RoutesManager { } } - await GitlabManager.moveRepository(repoId, Config.gitlab.group.deletedExercises); + // We rename (with unique str added) the repository before moving it because of potential name conflicts + const newName: string = `${ req.boundParams.exercise!.name }_${ uuidv4() }`; + await GitlabManager.renameRepository(repoId, newName); + const repository: ProjectSchema = await GitlabManager.moveRepository(repoId, Config.gitlab.group.deletedExercises); await db.exercise.update({ where: { id: req.boundParams.exercise!.id },