Skip to content

Commit

Permalink
Minor logic change
Browse files Browse the repository at this point in the history
SVCS-499
  • Loading branch information
TomBaxter authored and felliott committed Jun 1, 2018
1 parent f45e48a commit 2f2f8bc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions waterbutler/core/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,11 @@ def size_as_int(self) -> int:
""" Size of the file in bytes. Always an `int` or `None`. Some providers report size as a
`str`. Both exist to maintain backwards compatibility.
"""
if self.size is not None:
return int(self.size)
else:
return None
try:
size_as_int = int(self.size)
except (TypeError, ValueError):
size_as_int = None
return size_as_int


class BaseFileRevisionMetadata(metaclass=abc.ABCMeta):
Expand Down

0 comments on commit 2f2f8bc

Please sign in to comment.