mirror of https://gitlab.com/bashrc2/epicyon
Remove existing media files if not media is detected within a post
parent
105b125559
commit
e5c488031d
10
content.py
10
content.py
|
@ -932,6 +932,16 @@ def saveMediaInFormPOST(mediaBytes, debug: bool,
|
|||
Returns the filename and attachment type
|
||||
"""
|
||||
if not mediaBytes:
|
||||
if filenameBase:
|
||||
# remove any existing files
|
||||
extensionTypes = getImageExtensions()
|
||||
for ex in extensionTypes:
|
||||
possibleOtherFormat = filenameBase + '.' + ex
|
||||
if os.path.isfile(possibleOtherFormat):
|
||||
os.remove(possibleOtherFormat)
|
||||
if os.path.isfile(filenameBase):
|
||||
os.remove(filenameBase)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: No media found within POST')
|
||||
return None, None
|
||||
|
|
Loading…
Reference in New Issue