From 2f9ae10f836308d17572d201d2817ec48fe9d6b1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 14 Nov 2019 14:29:17 +0000 Subject: [PATCH] temp --- content.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/content.py b/content.py index 0201db7d9..36c633d06 100644 --- a/content.py +++ b/content.py @@ -438,7 +438,6 @@ def saveMediaInFormPOST(mediaBytes,debug: bool, \ # of an image extensionList= { 'png': 'image/png', - 'jpg': 'image/jpeg', 'jpeg': 'image/jpeg', 'gif': 'image/gif', 'webp': 'image/webp', @@ -476,13 +475,12 @@ def saveMediaInFormPOST(mediaBytes,debug: bool, \ # remove any existing image files with a different format extensionTypes=('png','jpg','jpeg','gif','webp') - if detectedExtension in extensionTypes: - for ex in extensionTypes: - if ex==detectedExtension: - continue - possibleOtherFormat=filename.replace('.'+detectedExtension,'.'+ex) - if os.path.isfile(possibleOtherFormat): - os.remove(possibleOtherFormat) + for ex in extensionTypes: + if ex==detectedExtension: + continue + possibleOtherFormat=filename.replace('.temp','').replace('.'+detectedExtension,'.'+ex) + if os.path.isfile(possibleOtherFormat): + os.remove(possibleOtherFormat) fd = open(filename, 'wb') fd.write(mediaBytes[startPos:])