Skip to content

Commit 94ecd0b

Browse files
committed
Adjust 'mkdir' logic
1 parent c9293b1 commit 94ecd0b

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/murfey/server/api/workflow_fib.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ async def make_gif(
9292
output_file = sanitise_path(gif_params.output_file)
9393
if not output_file.is_relative_to(rsync_basepath):
9494
logger.error("Output file path is not permitted")
95-
96-
# Create the directory structure
97-
if not (output_dir := output_file.parent).exists():
98-
output_dir.mkdir(parents=True)
99-
logger.debug(f"Created output directory {output_dir}")
100-
visit_index = output_dir.parts.index(visit_name)
101-
# Change permissions for folders in the visit directory and onwards
102-
for current_path in list(reversed(output_file.parents))[visit_index + 1 :]:
95+
raise ValueError
96+
97+
# Create folders in the visit directory and onwards and change permissions
98+
visit_index = output_file.parts.index(visit_name)
99+
for current_path in list(reversed(output_file.parents))[visit_index + 1 :]:
100+
if not current_path.exists():
101+
current_path.mkdir(parents=True)
102+
logger.debug(f"Created output directory {current_path}")
103103
try:
104104
os.chmod(current_path, mode=machine_config.mkdir_chmod)
105105
except PermissionError:

0 commit comments

Comments
 (0)