diff --git a/src/CSET/_workflow_utils/fetch_data.py b/src/CSET/_workflow_utils/fetch_data.py index ce4ecb71e..a11c10442 100755 --- a/src/CSET/_workflow_utils/fetch_data.py +++ b/src/CSET/_workflow_utils/fetch_data.py @@ -104,8 +104,11 @@ def get_file(self, file_path: str, output_dir: str) -> None: Path to filesystem directory into which the file should be copied. """ ctx = ssl.create_default_context() - save_path = urllib.parse.urlparse(file_path).path.split("/")[-1] - with urllib.request.urlopen(file_path, output_dir, context=ctx) as response: + save_path = ( + f"{output_dir.removesuffix('/')}/" + + urllib.parse.urlparse(file_path).path.split("/")[-1] + ) + with urllib.request.urlopen(file_path, context=ctx) as response: with open(save_path, "wb") as fp: # Read in 1 MiB chunks so data doesn't all have to be in memory. while data := response.read(1024 * 1024):