mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
upload: append file size if it hasn't been
This commit is contained in:
parent
95c7c4f87c
commit
6fae72b4cf
1 changed files with 5 additions and 0 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue