Fix accounting for imgur.io

This commit is contained in:
Butter Cat 2023-11-13 20:52:28 -05:00
parent 8a741f4d5f
commit a5c6fe0ed3

View file

@ -21,7 +21,7 @@ let
# Images aren't supported due to errors from Teddit when the image
# wasn't first displayed via a post on the Teddit instance.
imgurRegex = re"((i|i.stack)\.)?imgur.(com|io)"
imgurRegex = re"((i|i.stack)\.)?imgur\.(com|io)"
wwwRegex = re"https?://(www[0-9]?\.)?"
m3u8Regex = re"""url="(.+.m3u8)""""
@ -71,7 +71,7 @@ proc replaceUrls*(body: string; prefs: Prefs; absolute=""): string =
if prefs.replaceReddit in result and "/gallery/" in result:
result = result.replace("/gallery/", "/comments/")
if prefs.replaceImgur.len > 0 and "imgur.com" in result:
if prefs.replaceImgur.len > 0 and "imgur" in result:
result = result.replace(imgurRegex, prefs.replaceImgur)
if absolute.len > 0 and "href" in result: