1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-27 22:38:39 +09:00
This commit is contained in:
syuilo 2024-06-21 13:31:02 +09:00
parent 1d6ccd9781
commit e88f08ad7d

View File

@ -95,15 +95,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Check if the circular reference will occur
const checkCircle = async (folderId: string): Promise<boolean> => {
// Fetch folder
const folder2 = await this.driveFoldersRepository.findOneBy({
const folder2 = await this.driveFoldersRepository.findOneByOrFail({
id: folderId,
});
if (folder2!.id === folder!.id) {
if (folder2.id === folder.id) {
return true;
} else if (folder2!.parentId) {
return await checkCircle(folder2!.parentId);
} else if (folder2.parentId) {
return await checkCircle(folder2.parentId);
} else {
return false;
}