Skip to content

Commit

Permalink
#517 Use filehandle.size in utils.handle_size (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
jahazieldom authored Jun 28, 2024
1 parent 8f1307e commit 6187954
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dbbackup/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def handle_size(filehandle):
:returns: File's size with the best unit of measure
:rtype: str
"""
if hasattr(filehandle, "size"):
return bytes_to_str(filehandle.size)

filehandle.seek(0, 2)
return bytes_to_str(filehandle.tell())

Expand Down

0 comments on commit 6187954

Please sign in to comment.