fix: Avoid TypeError when guess_extension returns None
This commit is contained in:
parent
8d9b46527f
commit
adc745a72c
1 changed files with 3 additions and 1 deletions
|
|
@ -660,7 +660,9 @@ def get_extension(filename, extn, content: bytes = None, response: "Response" =
|
|||
content_type = response.headers.get("Content-Type")
|
||||
|
||||
if content_type:
|
||||
return mimetypes.guess_extension(content_type)[1:]
|
||||
_extn = mimetypes.guess_extension(content_type)
|
||||
if _extn:
|
||||
return _extn[1:]
|
||||
|
||||
if extn:
|
||||
# remove '?' char and parameters from extn if present
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue