From bc62dc16107888e6486e23a0139fce0ca938ae28 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Thu, 21 Jan 2021 00:28:36 -0500 Subject: [PATCH] fix gif attachment type, fix #61 --- .../Extractors/TweetExtractor.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/BirdsiteLive.Twitter/Extractors/TweetExtractor.cs b/src/BirdsiteLive.Twitter/Extractors/TweetExtractor.cs index 1d27ddb..f4bb8d1 100644 --- a/src/BirdsiteLive.Twitter/Extractors/TweetExtractor.cs +++ b/src/BirdsiteLive.Twitter/Extractors/TweetExtractor.cs @@ -89,8 +89,8 @@ namespace BirdsiteLive.Twitter.Extractors switch (mediaType) { case "photo": - var ext = Path.GetExtension(mediaUrl); - switch (ext) + var pExt = Path.GetExtension(mediaUrl); + switch (pExt) { case ".jpg": case ".jpeg": @@ -101,8 +101,15 @@ namespace BirdsiteLive.Twitter.Extractors return null; case "animated_gif": + var vExt = Path.GetExtension(mediaUrl); + switch (vExt) + { + case ".gif": + return "image/gif"; + case ".mp4": + return "video/mp4"; + } return "image/gif"; - case "video": return "video/mp4"; }