forked from indymedia/epicyon
temp
parent
109d184f54
commit
2f9ae10f83
14
content.py
14
content.py
|
@ -438,7 +438,6 @@ def saveMediaInFormPOST(mediaBytes,debug: bool, \
|
||||||
# of an image
|
# of an image
|
||||||
extensionList= {
|
extensionList= {
|
||||||
'png': 'image/png',
|
'png': 'image/png',
|
||||||
'jpg': 'image/jpeg',
|
|
||||||
'jpeg': 'image/jpeg',
|
'jpeg': 'image/jpeg',
|
||||||
'gif': 'image/gif',
|
'gif': 'image/gif',
|
||||||
'webp': 'image/webp',
|
'webp': 'image/webp',
|
||||||
|
@ -476,13 +475,12 @@ def saveMediaInFormPOST(mediaBytes,debug: bool, \
|
||||||
|
|
||||||
# remove any existing image files with a different format
|
# remove any existing image files with a different format
|
||||||
extensionTypes=('png','jpg','jpeg','gif','webp')
|
extensionTypes=('png','jpg','jpeg','gif','webp')
|
||||||
if detectedExtension in extensionTypes:
|
for ex in extensionTypes:
|
||||||
for ex in extensionTypes:
|
if ex==detectedExtension:
|
||||||
if ex==detectedExtension:
|
continue
|
||||||
continue
|
possibleOtherFormat=filename.replace('.temp','').replace('.'+detectedExtension,'.'+ex)
|
||||||
possibleOtherFormat=filename.replace('.'+detectedExtension,'.'+ex)
|
if os.path.isfile(possibleOtherFormat):
|
||||||
if os.path.isfile(possibleOtherFormat):
|
os.remove(possibleOtherFormat)
|
||||||
os.remove(possibleOtherFormat)
|
|
||||||
|
|
||||||
fd = open(filename, 'wb')
|
fd = open(filename, 'wb')
|
||||||
fd.write(mediaBytes[startPos:])
|
fd.write(mediaBytes[startPos:])
|
||||||
|
|
Loading…
Reference in New Issue