Avoid duplicated file extension

main
Bob Mottram 2022-12-10 11:17:33 +00:00
parent ed89a95cb5
commit 80fd77a1ce
1 changed files with 5 additions and 1 deletions

View File

@ -1474,7 +1474,11 @@ def save_media_in_form_post(media_bytes, debug: bool,
elif extension == 'wav4':
extension = 'wav'
if filename_base:
filename = filename_base + '.' + extension
if not filename_base.endswith('.' + extension):
filename = filename_base + '.' + extension
else:
# already has the extension
filename = filename_base
search_lst = search_str.decode().split('/', maxsplit=1)
attachment_media_type = \
search_lst[0].replace('Content-Type: ', '')