Skip to content

Commit

Permalink
Raise exception if CompressedFile used on incompatible file
Browse files Browse the repository at this point in the history
Surprised (or not actually ...) that mypy didn't catch this.
  • Loading branch information
mvdbeek committed Sep 25, 2024
1 parent c1bf181 commit 45c5a38
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/galaxy/util/compression_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ def __init__(self, file_path: StrPath, mode: str = "r") -> None:
self.file_type = "tar"
elif zipfile.is_zipfile(file_path) and not file_path_str.endswith(".jar"):
self.file_type = "zip"
else:
raise Exception("File must be valid zip or tar file.")
self.file_name = os.path.splitext(os.path.basename(file_path))[0]
if self.file_name.endswith(".tar"):
self.file_name = os.path.splitext(self.file_name)[0]
Expand Down

0 comments on commit 45c5a38

Please sign in to comment.