From 4fa983b8ea181c550d925dd02af8032d0387f39e Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Fri, 5 Aug 2022 16:48:32 -0400 Subject: [PATCH] Fixed #23 --- src/status.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/status.ts b/src/status.ts index 655313c..c995c7b 100644 --- a/src/status.ts +++ b/src/status.ts @@ -52,7 +52,8 @@ export const handleStatus = async ( if (tweet.media.video) { redirectUrl = tweet.media.video.url; } else if (tweet.media.photos) { - redirectUrl = (tweet.media.photos[mediaNumber || 0] || tweet.media.photos[0]).url; + const photos = tweet.media.photos; + redirectUrl = (photos[(mediaNumber || 1) - 1] || photos[0]).url; } if (redirectUrl) { return { response: Response.redirect(redirectUrl, 302) };