From d5c4e77c44a0d72670e3679294219329898c8e00 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 7 Jul 2023 10:53:06 +0900 Subject: update deps --- packages/backend/src/core/FileInfoService.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'packages/backend/src/core/FileInfoService.ts') diff --git a/packages/backend/src/core/FileInfoService.ts b/packages/backend/src/core/FileInfoService.ts index b6cae5ea75..d6c51ad559 100644 --- a/packages/backend/src/core/FileInfoService.ts +++ b/packages/backend/src/core/FileInfoService.ts @@ -304,11 +304,11 @@ export class FileInfoService { @bindThis public fixMime(mime: string | fileType.MimeType): string { // see https://github.com/misskey-dev/misskey/pull/10686 - if (mime === "audio/x-flac") { - return "audio/flac"; + if (mime === 'audio/x-flac') { + return 'audio/flac'; } - if (mime === "audio/vnd.wave") { - return "audio/wav"; + if (mime === 'audio/vnd.wave') { + return 'audio/wav'; } return mime; @@ -355,11 +355,12 @@ export class FileInfoService { * Check the file is SVG or not */ @bindThis - public async checkSvg(path: string) { + public async checkSvg(path: string): Promise { try { const size = await this.getFileSize(path); if (size > 1 * 1024 * 1024) return false; - return isSvg(fs.readFileSync(path)); + const buffer = await fs.promises.readFile(path); + return isSvg(buffer.toString()); } catch { return false; } -- cgit v1.2.3-freya