Check that media file is written

merge-requests/30/head
Bob Mottram 2021-03-06 23:16:54 +00:00
parent ada6680cf9
commit 6b2f22d562
1 changed files with 6 additions and 0 deletions

View File

@ -973,9 +973,15 @@ def saveMediaInFormPOST(mediaBytes, debug: bool,
os.remove(possibleOtherFormat)
fd = open(filename, 'wb')
if not fd:
return None, None
fd.write(mediaBytes[startPos:])
fd.close()
if not os.path.isfile(filename):
print('WARN: Media file could not be written to file: ' + filename)
return None, None
return filename, attachmentMediaType