From 1a19bfbe5bdad19e01bc9ed62f47476984fc2658 Mon Sep 17 00:00:00 2001 From: pen <121443048+penginn-net@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:41:24 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20getSensitiveFileCount=E3=81=AE=E3=82=AF?= =?UTF-8?q?=E3=82=A8=E3=83=AA=E4=BF=AE=E6=AD=A3=20(#541)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/core/DriveService.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts index 01f4de7a68..7a7513ceb7 100644 --- a/packages/backend/src/core/DriveService.ts +++ b/packages/backend/src/core/DriveService.ts @@ -9,7 +9,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { ModuleRef } from '@nestjs/core'; import sharp from 'sharp'; import { sharpBmp } from '@misskey-dev/sharp-read-bmp'; -import { IsNull } from 'typeorm'; +import { In, IsNull } from 'typeorm'; import { DeleteObjectCommandInput, PutObjectCommandInput, NoSuchKey } from '@aws-sdk/client-s3'; import { DI } from '@/di-symbols.js'; import type { DriveFilesRepository, UsersRepository, DriveFoldersRepository, UserProfilesRepository, MiMeta } from '@/models/_.js'; @@ -973,11 +973,10 @@ export class DriveService { if (FileIds.length === 0) return 0; let SensitiveCount = 0; - for (const FileId of FileIds) { - const file = await this.driveFilesRepository.findOneBy({ id: FileId }); - if (file?.isSensitive) SensitiveCount++; + const files = await this.driveFilesRepository.findBy({ id: In(FileIds) }); + for (const file of files) { + if (file.isSensitive) SensitiveCount++; } - return SensitiveCount; } }