mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
make_image_sizes_async: fall back to parsing the http content type if the url does not contain a file extension
This commit is contained in:
parent
9291821835
commit
884248987e
1 changed files with 5 additions and 0 deletions
|
@ -693,6 +693,11 @@ def make_image_sizes_async(file_id, thumbnail_width, medium_width, directory):
|
|||
source_image_response.close()
|
||||
|
||||
file_ext = os.path.splitext(file.source_url)[1]
|
||||
# fall back to parsing the http content type if the url does not contain a file extension
|
||||
if file_ext == '':
|
||||
content_type_parts = content_type.split('/')
|
||||
if content_type_parts:
|
||||
file_ext = '.' + content_type_parts[-1]
|
||||
|
||||
new_filename = gibberish(15)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue