From f4af0e240712fc11afbd4bdb5481075f8bb61f59 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Wed, 5 Jun 2024 15:40:37 -1000 Subject: [PATCH] fix(api): :bug: Prevent non-images uploaded from not being saved to object storage --- database/entities/Attachment.ts | 2 +- server/api/api/v2/media/index.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/database/entities/Attachment.ts b/database/entities/Attachment.ts index dea5b066..3e5a0c22 100644 --- a/database/entities/Attachment.ts +++ b/database/entities/Attachment.ts @@ -39,7 +39,7 @@ export const attachmentToAPI = ( ? `${attachment.width}x${attachment.height}` : undefined, duration: attachment.duration || undefined, - length: attachment.size?.toString() || undefined, + length: undefined, aspect: attachment.width && attachment.height ? attachment.width / attachment.height diff --git a/server/api/api/v2/media/index.ts b/server/api/api/v2/media/index.ts index 9b5433df..11d97aa9 100644 --- a/server/api/api/v2/media/index.ts +++ b/server/api/api/v2/media/index.ts @@ -112,11 +112,9 @@ export default (app: Hono) => throw new Error("Invalid media backend"); } - if (isImage) { - const { path } = await mediaManager.addFile(file); + const { path } = await mediaManager.addFile(file); - url = getUrl(path, config); - } + url = getUrl(path, config); let thumbnailUrl = "";