fix: Do not set content type for paths ending with .com

To avoid unnecessary download
This commit is contained in:
Suraj Shetty 2021-05-19 11:34:04 +05:30
parent 1be1c25e58
commit b193666c71

View file

@ -103,7 +103,9 @@ def set_content_type(response, data, path):
response.mimetype = 'text/html'
response.charset = 'utf-8'
if "." in path:
# ignore paths ending with .com to avoid unnecessary download
# https://bugs.python.org/issue22347
if "." in path and not path.endswith('.com'):
content_type, encoding = mimetypes.guess_type(path)
if content_type:
response.mimetype = content_type