From 0b7c7dd42642a3972348db1fed47e0cd15ca1d0b Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Tue, 17 Dec 2024 19:41:15 +0100 Subject: [PATCH] create missing dirs when symlinking files --- src/bma_client_lib/bma_client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bma_client_lib/bma_client.py b/src/bma_client_lib/bma_client.py index 99584f8..bd4e232 100644 --- a/src/bma_client_lib/bma_client.py +++ b/src/bma_client_lib/bma_client.py @@ -378,6 +378,7 @@ def upload_file(self, path: Path, attribution: str, file_license: str) -> dict[s # create symlink to file in workdir workpath = self.path / r.json()["bma_response"]["links"]["downloads"]["original"][1:] if not workpath.exists(): + workpath.parent.mkdir(exist_ok=True) workpath.symlink_to(path) return r.json() # type: ignore[no-any-return]