Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Commit

Permalink
fix(auditing): avoid crashing on empty default branch
Browse files Browse the repository at this point in the history
  • Loading branch information
aexvir committed Mar 12, 2021
1 parent 5c2d0f5 commit 782852b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions zoo/repos/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ def download_repository(repository, fake_dir, sha=None):
except MissingFilesError as e:
raise MissingFilesError(f"{repository} doesn't have any files.") from e

archive.seek(0)
with tarfile.open(fileobj=archive) as tar:
inner_folder = tar.next().name
tar.extractall(fake_dir)
try:
archive.seek(0)
with tarfile.open(fileobj=archive) as tar:
inner_folder = tar.next().name
tar.extractall(fake_dir)
except tarfile.ReadError as e:
raise MissingFilesError(f"{repository} doesn't have any files.") from e

return Path(fake_dir) / inner_folder

Expand Down

0 comments on commit 782852b

Please sign in to comment.