fix media type for files without extension

This commit is contained in:
Alex Grintsvayg 2019-01-09 09:18:54 -05:00 committed by Lex Berezhny
parent db3e578bcd
commit 8a5f3842fc

View file

@ -153,4 +153,5 @@ types_map = {
def guess_media_type(path):
_, ext = os.path.splitext(path)
return types_map.get(ext, f'application/x-ext-{ext}')
default = f'application/x-ext-{ext}' if ext else 'application/octet-stream'
return types_map.get(ext, default)