diff --git a/articat/fs_artifact.py b/articat/fs_artifact.py index 5330325..aacc180 100644 --- a/articat/fs_artifact.py +++ b/articat/fs_artifact.py @@ -73,9 +73,12 @@ def main_dir(self) -> str: """ # to not worry about presence of scheme, we remove the prefix # and add it back - if self.files_dir: + if self._file_prefix is not None: + return self._file_prefix + elif self.files_dir: return self.files_dir - # TODO: remove this code path + # TODO: remove this code path, for this to be safe to remove + # we need to update legacy artifacts first (or remove them) # This is the legacy handling of the main_dir, where we gather # main dir from the files_pattern assert self.files_pattern is not None diff --git a/articat/tests/fs_artifact_test.py b/articat/tests/fs_artifact_test.py index c579d7e..83fa5ae 100644 --- a/articat/tests/fs_artifact_test.py +++ b/articat/tests/fs_artifact_test.py @@ -26,6 +26,7 @@ def test_fs_artifact_join_paths_works(uid: ID) -> None: with fsspec.open(p, "w") as f: f.write("ala ma kota") a.files_pattern = None + assert a.main_dir == a.staging_file_prefix assert p == f"{a.staging_file_prefix}/data.dat" assert a._file_prefix is None p = a.joinpath("data.dat")