Commit e39f5937 authored by kezzle's avatar kezzle
Browse files

Remove unneeded path joins

parent b5231d63
......@@ -155,7 +155,7 @@ class Sanitizer:
container_id, output = self.runner.run(
docker_args=[
"--volume",
join(os.path.abspath(path) + ":", "tmp", "input_file"),
join(os.path.abspath(path), ":/tmp/input_file"),
],
args=["document-to-pixels-unpriv"],
)
......@@ -378,11 +378,11 @@ class ProcessingClient(wc.Client):
logging.info("sanitizing %s %s", folder, path)
# non-empty folder or regular file
if len(listing) > 1 or not path.endswith("/"):
remote_processing_path = join(folder, "dangerzone", "processing", path)
remote_processing_path = join(folder, "dangerzone/processing", path)
logging.info("moving %s to %s before processing", path, remote_processing_path)
if not self.dryrun:
self.mkdir(join(folder, "dangerzone"))
self.mkdir(join(folder, "dangerzone", "processing"))
self.mkdir(join(folder, "dangerzone/processing"))
try:
self.move(remote_path_from=join(folder, path), remote_path_to=remote_processing_path)
except ResponseErrorCode as e:
......@@ -412,7 +412,7 @@ class ProcessingClient(wc.Client):
# TODO: error handling:
# 5. on failure, delete the failed file locally, and
# move it to a dangerzone/rejected folder remotely
remote_rejected_path = join(folder, "dangerzone", "rejected", path)
remote_rejected_path = join(folder, "dangerzone/rejected", path)
logging.warning(
"cannot process %s (%s), moving to %s",
path,
......@@ -420,7 +420,7 @@ class ProcessingClient(wc.Client):
remote_rejected_path,
)
if not self.dryrun:
self.mkdir(join(folder, "dangerzone", "rejected"))
self.mkdir(join(folder, "dangerzone/rejected"))
try:
self.move(
remote_path_from=remote_processing_path,
......@@ -443,7 +443,7 @@ class ProcessingClient(wc.Client):
# 6. on success, upload the sanitized file to a safe/
# folder, move the original to dangerzone/processed
remote_safe_path = join(folder, "safe", path)
local_safe_path = join(self.sanitizer.safe_dir, "/", path)
local_safe_path = join(self.sanitizer.safe_dir, path)
logging.info(
"uploading %s to %s", local_safe_path, remote_safe_path
)
......@@ -453,13 +453,13 @@ class ProcessingClient(wc.Client):
remote_path=remote_safe_path,
local_path=local_safe_path,
)
remote_processed_path = join(folder, "dangerzone", "processed", path)
remote_processed_path = join(folder, "dangerzone/processed", path)
logging.info(
"renaming %s to %s", remote_processing_path, remote_processed_path,
)
if not self.dryrun:
# TODO: turn "dangerzone/processed" into a constant
self.mkdir(join(folder, "dangerzone", "processed"))
self.mkdir(join(folder, "dangerzone/processed"))
try:
self.move(
remote_path_from=remote_processing_path,
......
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