Skip to content

Commit

Permalink
Fix ZeroDivisionError in fetch_artifact.py (#4299)
Browse files Browse the repository at this point in the history
Fixes a ZeroDivisionError in the download_artifact function of
fetch_artifact.py. The error occured when attempting to calculate the
download progress percentage of an zero file size artifact.
  • Loading branch information
aditya-wazir authored Oct 8, 2024
1 parent 01e8cf9 commit dcbb1e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/clusterfuzz/_internal/platforms/android/fetch_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ def download_artifact(client, bid, target, attempt_id, name, output_directory,
status, done = downloader.next_chunk()
if status:
size_completed = int(status.resumable_progress)
percent_completed = (size_completed * 100.0) / size
logs.info('%.1f%% complete.' % percent_completed)
if size != 0:
percent_completed = (size_completed * 100.0) / size
logs.info('%.1f%% complete.' % percent_completed)

return output_path

Expand Down

0 comments on commit dcbb1e3

Please sign in to comment.