From 892b875e3f4e7c8f57d60adf8fdef60c936073df Mon Sep 17 00:00:00 2001 From: wukko Date: Sat, 31 Aug 2024 14:27:46 +0600 Subject: [PATCH] api/reddit: add a filename to returned gifs --- api/src/processing/services/reddit.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/src/processing/services/reddit.js b/api/src/processing/services/reddit.js index 271cdc86..30084599 100644 --- a/api/src/processing/services/reddit.js +++ b/api/src/processing/services/reddit.js @@ -73,9 +73,12 @@ export default async function(obj) { data = data[0]?.data?.children[0]?.data; + const id = `${String(obj.sub).toLowerCase()}_${obj.id}`; + if (data?.url?.endsWith('.gif')) return { typeId: "redirect", - urls: data.url + urls: data.url, + filename: `reddit_${id}.gif`, } if (!data.secure_media?.reddit_video) @@ -109,8 +112,6 @@ export default async function(obj) { }).catch(() => {}) } - let id = `${String(obj.sub).toLowerCase()}_${obj.id}`; - if (!audio) return { typeId: "redirect", urls: video