Skip to content

Commit cc44ea0

Browse files
committed
Change sanitisation logic
1 parent d9db531 commit cc44ea0

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/murfey/server/api/workflow_fib.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ async def make_gif(
8989
rsync_basepath = machine_config.rsync_basepath or Path(".").resolve()
9090

9191
# Sanitise and verify that the output directory is relative to rsync basepath
92-
output_dir = sanitise_path(gif_params.output_file.parent)
93-
if not output_dir.is_relative_to(rsync_basepath):
94-
logger.error("Output directory path is not permitted")
92+
output_file = sanitise_path(gif_params.output_file)
93+
if not output_file.is_relative_to(rsync_basepath):
94+
logger.error("Output file path is not permitted")
9595

9696
# Create the directory structure
97-
if not (output_dir := gif_params.output_file.parent).exists():
97+
if not (output_dir := output_file.parent).exists():
9898
output_dir.mkdir(parents=True)
9999
logger.debug(f"Created output directory {output_dir}")
100100
visit_index = output_dir.parts.index(visit_name)
@@ -130,12 +130,12 @@ async def make_gif(
130130
# Convert back to PIL.Image objects and save as GIF
131131
converted = [PIL.Image.fromarray(arr[f], mode="L") for f in range(len(images))]
132132
converted[0].save(
133-
gif_params.output_file,
133+
output_file,
134134
format="GIF",
135135
append_images=converted[1:],
136136
save_all=True,
137137
duration=30,
138138
loop=0,
139139
)
140-
logger.info(f"Created GIF file {gif_params.output_file}")
141-
return {"output_gif": str(gif_params.output_file)}
140+
logger.info(f"Created GIF file {output_file}")
141+
return {"output_gif": str(output_file)}

0 commit comments

Comments
 (0)