Explorar o código

Fix more wrong mimetypes

Zed %!s(int64=6) %!d(string=hai) anos
pai
achega
4104bfcba9
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/utils.nim

+ 2 - 1
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)] =