fix(pets): adds file ext validation on the server side
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import re
|
||||
from typing import Optional
|
||||
|
||||
class Validators:
|
||||
|
||||
@staticmethod
|
||||
@@ -17,4 +16,10 @@ class Validators:
|
||||
float(value)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def allowed_file_img(filename):
|
||||
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'webp'}
|
||||
return '.' in filename and \
|
||||
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
||||
Reference in New Issue
Block a user