Skip to content

Commit

Permalink
Fix the names when duplicate files exist (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-persson authored Oct 24, 2024
1 parent 60b5e31 commit 69075a7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cli/src/etos_client/downloader/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ def __save_file(self, item: Downloadable, response: requests.Response) -> None:
with self.__lock:
download_path.parent.mkdir(exist_ok=True, parents=True)
index = 0
original_name = download_path.name
while download_path.exists():
index += 1
download_path = download_path.with_name(f"{index}_{download_path.name}")
download_path = download_path.with_name(f"{index}_{original_name}")
self.logger.debug("Saving file %s", download_path)
with self.__lock:
self.downloads.add(str(download_path))
Expand Down

0 comments on commit 69075a7

Please sign in to comment.