Skip to content

Commit

Permalink
fix: do not allow infinite loops
Browse files Browse the repository at this point in the history
  • Loading branch information
mfacchinelli committed Jan 27, 2025
1 parent 0faceff commit f05d564
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/imap_mag/outputManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ def __get_next_available_version(
f"File {destination_file} already exists and is different. Increasing version to {metadata_provider.version}."
)
metadata_provider.version += 1
destination_file = self.__assemble_full_path(metadata_provider)
updated_file = self.__assemble_full_path(metadata_provider)

if destination_file == updated_file:
logging.error(
f"File {destination_file} already exists and is different. Cannot increase version."
)
raise FileExistsError(
f"File {destination_file} already exists and is different. Cannot increase version."
)

destination_file = updated_file

return metadata_provider.version

0 comments on commit f05d564

Please sign in to comment.