From 6fae72b4cf2072ac32fa891f3e7e831cb4a96166 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 7 Nov 2024 13:10:15 -0600 Subject: [PATCH] upload: append file size if it hasn't been --- src/utils/upload.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/upload.ts b/src/utils/upload.ts index fc5d7086..ae86298c 100644 --- a/src/utils/upload.ts +++ b/src/utils/upload.ts @@ -46,6 +46,7 @@ export async function uploadFile( const x = tags.find(([key]) => key === 'x')?.[1]; const m = tags.find(([key]) => key === 'm')?.[1]; const dim = tags.find(([key]) => key === 'dim')?.[1]; + const size = tags.find(([key]) => key === 'size')?.[1]; const blurhash = tags.find(([key]) => key === 'blurhash')?.[1]; if (!x) { @@ -57,6 +58,10 @@ export async function uploadFile( tags.push(['m', file.type]); } + if (!size) { + tags.push(['size', file.size.toString()]); + } + // If the uploader didn't already, try to get a blurhash and media dimensions. // This requires `MEDIA_ANALYZE=true` to be configured because it comes with security tradeoffs. if (Conf.mediaAnalyze && (!blurhash || !dim)) {