Skip to content
Snippets Groups Projects
Commit 680df43e authored by michael.minelli's avatar michael.minelli
Browse files

ExercisesRoutes => Rename exercise before moving it for prevent names conflict

parent 112b45d2
Branches
Tags
No related merge requests found
......@@ -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 },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment