From 644fe41a08e41313894a017b934e5d89889202ac Mon Sep 17 00:00:00 2001 From: decoy-walrus Date: Tue, 8 Feb 2022 14:50:56 -0500 Subject: [PATCH] Use the correct format string for fetching files from twitter. Per their docs https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/entities#photo_format --- src/routes/media.nim | 2 +- src/views/tweet.nim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/media.nim b/src/routes/media.nim index 95446a1..e63a0f8 100644 --- a/src/routes/media.nim +++ b/src/routes/media.nim @@ -94,7 +94,7 @@ proc createMediaRouter*(cfg: Config) = url.insert(twimg) if not url.startsWith(https): url.insert(https) - url.add(":orig") + url.add("?name=orig") let uri = parseUri(url) cond isTwitterUrl(uri) == true diff --git a/src/views/tweet.nim b/src/views/tweet.nim index e64f959..51d427f 100644 --- a/src/views/tweet.nim +++ b/src/views/tweet.nim @@ -10,7 +10,7 @@ import general proc getSmallPic(url: string): string = result = url if "?" notin url and not url.endsWith("placeholder.png"): - result &= ":small" + result &= "?name=small" result = getPicUrl(result) proc renderMiniAvatar(user: User; prefs: Prefs): VNode = @@ -58,7 +58,7 @@ proc renderAlbum(tweet: Tweet): VNode = let named = "name=" in photo orig = photo - small = if named: photo else: photo & ":small" + small = if named: photo else: photo & "?name=small" a(href=getOrigPicUrl(orig), class="still-image", target="_blank"): genImg(small)