diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index 8c5fc09..c3e144f 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -469,11 +469,12 @@ async function processUrl(msg, url, spoiler = false) { files.push({ name: - (cw != "" || spoiler ? "SPOILER_" : "") + attachment.type.indexOf("/") > -1 + (cw != "" || spoiler ? "SPOILER_" : "") + + (attachment.type.indexOf("/") > -1 ? attachment.type.replace("/", ".") : attachment.type + "." + - (url.match(/\.([a-z0-9]{3,4})$/)?.[0] ?? "mp4"), + (url.match(/\.([a-z0-9]{3,4})$/)?.[0] ?? "mp4")), contents: file, }); } @@ -501,7 +502,8 @@ async function processUrl(msg, url, spoiler = false) { files.push({ name: - (cw != "" || spoiler ? "SPOILER_" : "") + attachment.type.indexOf("/") > -1 + (cw != "" || spoiler ? "SPOILER_" : "") + + (attachment.type.indexOf("/") > -1 ? attachment.type .replace("/", ".") .replace("mpeg", "mp3") @@ -509,7 +511,7 @@ async function processUrl(msg, url, spoiler = false) { .replace("x-wav", "wav") : attachment.type + "." + - (url.match(/\.([a-z0-9]{3,4})$/)?.[0] ?? "mp3"), + (url.match(/\.([a-z0-9]{3,4})$/)?.[0] ?? "mp3")), contents: file, }); }