From 1b374b667e24835805a355b70e9d50f3caac67fe Mon Sep 17 00:00:00 2001 From: lelo Date: Tue, 3 Jun 2025 19:16:37 +0000 Subject: [PATCH] add wildcards in blocked_filenames --- app.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index d7ecfa0..d6a1857 100755 --- a/app.py +++ b/app.py @@ -24,6 +24,7 @@ import auth import analytics as a import folder_secret_config_editor as fsce import helperfunctions as hf +import fnmatch app_config = auth.return_app_config() BASE_DIR = os.path.realpath(app_config['BASE_DIR']) @@ -136,7 +137,7 @@ def list_directory_contents(directory, subpath): music_exts = ('.mp3',) image_exts = ('.jpg', '.jpeg', '.png', '.gif', '.bmp') - blocked_filenames = ['Thumbs.db'] + blocked_filenames = ['Thumbs.db', '*.mrk'] try: with os.scandir(directory) as it: @@ -146,8 +147,8 @@ def list_directory_contents(directory, subpath): if entry.name.startswith('.'): continue - # Skip blocked_filenames - if entry.name in blocked_filenames: + # Skip blocked_filenames using fnmatch for wildcards + if any(fnmatch.fnmatch(entry.name, pattern) for pattern in blocked_filenames): continue if entry.is_dir(follow_symlinks=False):