Commit 1a04b31a authored by anarcat's avatar anarcat
Browse files

Merge branch 'issue-8' into 'main'

fix incorrect SPECIAL_FOLDERS path check

Closes #8

See merge request !1
parents eac34971 9db307b5
......@@ -286,7 +286,20 @@ class DockerRunner(object):
subprocess.run(cmd, 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
SPECIAL_FOLDERS = (
"dangerzone-processed",
"dangerzone-processing",
"dangerzone-rejected",
"safe"
)
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():
......@@ -331,7 +344,7 @@ def main():
class ProcessingClient(wc.Client):
def process_path(self, folder, path):
if path in SPECIAL_FOLDERS:
if is_special_folder(path):
logging.debug("found special folder %s, skipping", path)
return
......
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