Skip to content

Commit 80fd6d9

Browse files
committed
Handle existing but broken symlink to snapshot file
Signed-off-by: Oliver Walsh <[email protected]>
1 parent 69e0929 commit 80fd6d9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ramalama/model_store.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,10 @@ def _download_snapshot_files(self, model_tag: str, snapshot_hash: str, snapshot_
448448
raise ValueError(f"Checksum verification failed for blob {dest_path}")
449449

450450
link_path = self.get_snapshot_file_path(snapshot_hash, file.name)
451-
if not os.path.exists(link_path):
451+
try:
452+
os.symlink(blob_relative_path, link_path)
453+
except FileExistsError:
454+
os.unlink(link_path)
452455
os.symlink(blob_relative_path, link_path)
453456

454457
# save updated ref file

0 commit comments

Comments
 (0)