diff --git a/src/server/api/endpoints/drive/folders/delete.ts b/src/server/api/endpoints/drive/folders/delete.ts index ece16ebed4..41f9108788 100644 --- a/src/server/api/endpoints/drive/folders/delete.ts +++ b/src/server/api/endpoints/drive/folders/delete.ts @@ -44,7 +44,7 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) = const [childFoldersCount, childFilesCount] = await Promise.all([ DriveFolder.count({ parentId: folder._id }), - DriveFile.count({ folderId: folder._id }) + DriveFile.count({ 'metadata.folderId': folder._id }) ]); if (childFoldersCount !== 0 || childFilesCount !== 0) {