Commit 6ccfba06 authored by Frédéric Escudié's avatar Frédéric Escudié
Browse files

Fix bug with unit bytes in check file size.

parent 88038486
......@@ -77,10 +77,15 @@ def get_nb_octet(size):
Return the number of bytes: value has to be formated like this: 5Mb, 20Gb ...
"""
octets_link = ["bytes", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb"]
unit = size[len(size)-2:len(size)]
if size.endswith("bytes"):
unit = "bytes"
isize = size[:len(size)-5]
else:
unit = size[len(size)-2:len(size)]
isize = size[:len(size)-2]
pow_val = int(octets_link.index(unit)) * 10
val = pow(2, pow_val)
nb_octet = int(size[:len(size)-2]) * val
nb_octet = float(isize) * val
return nb_octet
def get_octet_string_representation(size):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment