Correct handling of bare bytes values

This commit is contained in:
Joshua Boniface 2020-02-17 12:32:20 -05:00
parent 59ca296c58
commit 7c99618752
1 changed files with 2 additions and 2 deletions

View File

@ -97,8 +97,8 @@ def format_bytes_tohuman(databytes):
def format_bytes_fromhuman(datahuman):
# Trim off human-readable character
dataunit = datahuman[-1]
datasize = int(datahuman[:-1])
dataunit = str(datahuman)[-1]
datasize = int(str(datahuman)[:-1])
if not re.match('[A-Z]', dataunit):
dataunit = 'B'
datasize = int(datahuman)