Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
TPA
dangerzone webdav processor
Commits
1a04b31a
Commit
1a04b31a
authored
Jun 10, 2021
by
anarcat
Browse files
Merge branch 'issue-8' into 'main'
fix incorrect SPECIAL_FOLDERS path check Closes
#8
See merge request
!1
parents
eac34971
9db307b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
processor.py
View file @
1a04b31a
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment