Ensure datahuman is a string if it's not

This commit is contained in:
Joshua Boniface 2024-11-18 16:52:55 -05:00
parent 31254e8174
commit f4e946c262
1 changed files with 3 additions and 0 deletions

View File

@ -121,6 +121,9 @@ def format_bytes_tohuman(databytes):
def format_bytes_fromhuman(datahuman):
if not isinstance(datahuman, str):
datahuman = str(datahuman)
if not re.search(r"[A-Za-z]+", datahuman):
dataunit = "B"
datasize = float(datahuman)