From 4104bfcba9ed5adb88a1ec9558d53b16a4a18e15 Mon Sep 17 00:00:00 2001 From: Zed Date: Mon, 21 Oct 2019 07:49:43 +0200 Subject: [PATCH] Fix more wrong mimetypes --- src/utils.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.nim b/src/utils.nim index da12d0f..23b8797 100644 --- a/src/utils.nim +++ b/src/utils.nim @@ -10,6 +10,7 @@ const "pbs.twimg.com", "video.twimg.com" ] + badExts = @["1500x500", "jpgn", "jpg:", "jpg_"] proc getHmac*(data: string): string = ($hmac(sha256, key, data))[0 .. 12] @@ -29,7 +30,7 @@ proc getPicUrl*(link: string): string = proc cleanFilename*(filename: string): string = const reg = re"[^A-Za-z0-9._-]" result = filename.replace(reg, "_") - if "1500x500" in result or "name_orig" in result: + if badExts.anyIt(it in result): result &= ".jpg" proc filterParams*(params: Table): seq[(string, string)] =