consider . extension

This commit is contained in:
Thomas Zarebczan 2019-02-15 18:30:37 -05:00 committed by Jack Robison
parent 43b372c0fe
commit 652d7cbd24
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -154,5 +154,5 @@ types_map = {
def guess_media_type(path): def guess_media_type(path):
_, ext = os.path.splitext(path) _, ext = os.path.splitext(path)
default = 'application/octet-stream' if not ext else f'application/x-ext-{ext[1:].strip().lower()}' default = 'application/octet-stream' if not (ext and ext[1:].strip()) else f'application/x-ext-{ext[1:].strip().lower()}'
return types_map.get(ext, default) return types_map.get(ext, default)