fix extension - remove dot

The rest of our extensions don't have a dot. Also, strip off any characters and lowercase it to be safe.
This commit is contained in:
Thomas Zarebczan 2019-02-15 18:13:00 -05:00 committed by Jack Robison
parent eaacf7e034
commit 43b372c0fe
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):
_, ext = os.path.splitext(path)
default = f'application/x-ext-{ext}' if ext else 'application/octet-stream'
default = 'application/octet-stream' if not ext else f'application/x-ext-{ext[1:].strip().lower()}'
return types_map.get(ext, default)