Fix #1095 incorrect piece size used when using some non-English languages

This commit is contained in:
Andrew Resch 2009-12-17 21:27:04 +00:00
parent f03d1818fa
commit a161bbfcb6
1 changed files with 7 additions and 3 deletions

View File

@ -115,9 +115,13 @@ class CreateTorrentDialog:
def parse_piece_size_text(self, value):
psize, metric = value.split()
psize = int(psize) * 1024
if metric[0] == 'M':
psize *= 1024
psize = int(psize)
if psize < 32:
# This is a MiB value
psize = psize * 1024 * 1024
else:
# This is a KiB value
psize = psize * 1024
return psize