Commit 72fe9666 authored by kezzle's avatar kezzle
Browse files

fix incorrect SPECIAL_FOLDERS path check

remove trailing slash from SPECIAL_FOLDERS entry
create function to normalize paths before checking to make things easier for
closes #8
parent eac34971
......@@ -286,7 +286,20 @@ class DockerRunner(object):, check=True, stdout=subprocess.DEVNULL)
SPECIAL_FOLDERS = ("dangerzone-processed", "dangerzone-processing/", "dangerzone-rejected/", "safe/")
# NOTE: do *not* add a trailing or leading slash to a SPECIAL_FOLDERS entry
# the `folder` param is stripped for a better check
def is_special_folder(folder: str) -> bool:
"""Normalize `folder` and check if it's in `SPECIAL_FOLDERS`"""
return folder.strip('/') in SPECIAL_FOLDERS
def main():
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment