mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-31 11:04:20 +01:00
upload: append file size if it hasn't been
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user