fix: extension check

disregard the first period, otherwise the `filename.` test fails.
This commit is contained in:
Thomas Zarebczan 2019-04-01 14:45:45 -04:00 committed by Lex Berezhny
parent eb2cd8fec1
commit 021e30ffde

View file

@ -160,7 +160,7 @@ types_map = {
def guess_media_type(path): def guess_media_type(path):
_, ext = os.path.splitext(path) _, ext = os.path.splitext(path)
extension = ext.strip().lower() extension = ext.strip().lower()
if extension: if extension[1:]:
if extension in types_map: if extension in types_map:
return types_map[extension][0] return types_map[extension][0]
return f'application/x-ext-{extension[1:]}' return f'application/x-ext-{extension[1:]}'