Skip to content
Snippets Groups Projects
Unverified Commit e2e9c7c8 authored by Volkor Barbarian Warrior's avatar Volkor Barbarian Warrior
Browse files

Allow files with no ext. (Fixes #8)

parent 24db1586
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@ config["ALLOW_ALL_FILES"] = False
config["ALLOWED_EXTENSIONS"] = set(['txt', 'pdf', 'bmp', 'png', 'jpg', 'jpeg', 'gif', 'webm', 'log', 'bin', 'webp', 'heif', 'mov', 'mkv', 'mp4', 'mp3', 'ogg', 'flac' ])
# Will use blacklist if this is enabled. You must disable ALLOW_ALL_FILES for this to take effect
## Note: Will always allow files with no extensions, as they /should/ be rendered as text.
config["BLACKLIST"] = True
config["BANNED_EXTENSIONS"] = set(['exe', 'msi', 'html', 'js', 'php'])
......@@ -46,7 +47,7 @@ config["CLEAN_INTERVAL"] = 300
## MINDAYS is the minimum lifetime of the file. (The smaller the file, the closer to MAXDAYS it is.)
## Default, seemingly sane defaults are really small files expire after a ~year, thicc files delete after ~5 days.
config["USE_0x0_DELETION"] = False
config["MAX_FILESIZE"] = 512 * 1024 * 1024
config["MAX_FILESIZE"] = 1024 * 1024 * 1024
config["MINDAYS"] = 5
config["MAXDAYS"] = 365
......
......@@ -34,6 +34,7 @@ config["ALLOW_ALL_FILES"] = False
config["ALLOWED_EXTENSIONS"] = set(['txt', 'pdf', 'bmp', 'png', 'jpg', 'jpeg', 'gif', 'webm', 'log', 'bin', 'webp', 'heif', 'mov', 'mkv', 'mp4', 'mp3', 'ogg', 'flac' ])
# Will use blacklist if this is enabled. You must disable ALLOW_ALL_FILES for this to take effect
## Note: Will always allow files with no extensions, as they /should/ be rendered as text.
config["BLACKLIST"] = True
config["BANNED_EXTENSIONS"] = set(['exe', 'msi', 'html', 'js', 'php'])
......
......@@ -93,7 +93,10 @@ def allowed_file(filename):
return True
else:
if config["BLACKLIST"]:
return '.' in filename and filename.rsplit('.', 1)[1] not in config["BANNED_EXTENSIONS"]
if '.' not in filename:
return True
else:
return '.' in filename and filename.rsplit('.', 1)[1] not in config["BANNED_EXTENSIONS"]
else:
return '.' in filename and filename.rsplit('.', 1)[1] in config["ALLOWED_EXTENSIONS"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment