mirror of https://gitlab.com/bashrc2/epicyon
Tidying of image formats
parent
36303ab578
commit
0627c10996
|
@ -256,6 +256,7 @@ from utils import saveJson
|
|||
from utils import isSuspended
|
||||
from utils import dangerousMarkup
|
||||
from utils import refreshNewswire
|
||||
from utils import isImageFile
|
||||
from manualapprove import manualDenyFollowRequest
|
||||
from manualapprove import manualApproveFollowRequest
|
||||
from announce import createAnnounce
|
||||
|
@ -13235,12 +13236,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
print('DEBUG: no media filename in POST')
|
||||
|
||||
if filename:
|
||||
if filename.endswith('.png') or \
|
||||
filename.endswith('.jpg') or \
|
||||
filename.endswith('.webp') or \
|
||||
filename.endswith('.avif') or \
|
||||
filename.endswith('.svg') or \
|
||||
filename.endswith('.gif'):
|
||||
if isImageFile(filename):
|
||||
postImageFilename = filename.replace('.temp', '')
|
||||
print('Removing metadata from ' + postImageFilename)
|
||||
city = getSpoofedCity(self.server.city,
|
||||
|
|
9
utils.py
9
utils.py
|
@ -270,6 +270,15 @@ def getImageFormats() -> str:
|
|||
return imageFormats
|
||||
|
||||
|
||||
def isImageFile(filename: str) -> bool:
|
||||
"""Is the given filename an image?
|
||||
"""
|
||||
for ext in getImageExtensions():
|
||||
if filename.endswith('.' + ext):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def getMediaFormats() -> str:
|
||||
"""Returns a string of permissable media formats
|
||||
used when selecting an attachment for a new post
|
||||
|
|
Loading…
Reference in New Issue