From d2bbf5c0405abd6f2daff79df1e8bdd2cd50d783 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Tue, 17 Jan 2023 12:27:55 -0700 Subject: [PATCH] fedimbed: spoiler try 2 --- src/modules/fedimbed.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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, }); }