#1 Allow searches to be made from the main page

This commit is contained in:
2024-01-22 10:49:08 +00:00
parent 216d71c15d
commit 897d4ab9aa
6 changed files with 24 additions and 34 deletions

0
utils/__init__.py Normal file
View File

11
utils/file_utils.py Normal file
View File

@ -0,0 +1,11 @@
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
def allowed_file(filename):
""" Ensures only filenames ending with the correct extension are allowed.
Note: This does not verify that the content inside of the file
matches the type specified
"""
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS