.txt.gz is not actually .txt

This commit is contained in:
ed 2021-11-05 00:29:25 +01:00
parent 4d0c6a8802
commit 977f09c470

View file

@ -1280,7 +1280,14 @@ def guess_mime(url, fallback="application/octet-stream"):
except:
return fallback
ret = MIMES.get(ext) or mimetypes.guess_type(url)[0] or fallback
ret = MIMES.get(ext)
if not ret:
x = mimetypes.guess_type(url)
ret = "application/{}".format(x[1]) if x[1] else x[0]
if not ret:
ret = fallback
if ";" not in ret:
if ret.startswith("text/") or ret.endswith("/javascript"):