Move the hidden filenames (thumbs.db etc) to a global const.

This commit is contained in:
Ethan Dalool 2020-10-31 01:00:06 -07:00
parent 138f376ce7
commit 90ac6c87ac

View file

@ -55,6 +55,7 @@ PASSWORD_PROMPT_HTML = '''
''' '''
ROOT_DIRECTORY = pathclass.Path(os.getcwd()) ROOT_DIRECTORY = pathclass.Path(os.getcwd())
HIDDEN_FILENAMES = {'thumbs.db', 'desktop.ini', '$recycle.bin', 'system volume information'}
TOKEN_COOKIE_NAME = 'simpleserver_token' TOKEN_COOKIE_NAME = 'simpleserver_token'
# SERVER ########################################################################################### # SERVER ###########################################################################################
@ -358,7 +359,7 @@ def generate_opendir(path):
files = [] files = []
for item in sorted(items, key=lambda p: p.basename.lower()): for item in sorted(items, key=lambda p: p.basename.lower()):
if item.basename.lower() in {'thumbs.db', 'desktop.ini', '$recycle.bin'}: if item.basename.lower() in HIDDEN_FILENAMES:
continue continue
if item.is_dir: if item.is_dir:
directories.append(item) directories.append(item)