mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-15 09:51:21 +00:00
storage: Fix issue with locales that use other decimal separators
- Convert commas to periods - Convert arabic decimal operator instead to period Signed-off-by: Johannes Keyser <johanneskeyser@posteo.de> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
382e2be7f9
commit
58c15e6215
@ -104,6 +104,8 @@ def warn_about_low_disk_space(request):
|
||||
|
||||
def _interpret_size_string(size_str):
|
||||
"""Convert size string to number of bytes."""
|
||||
size_str = size_str.replace(',', '.') # some locales use commas
|
||||
size_str = size_str.replace('٫', '.') # arabic decimal separator
|
||||
if size_str[-1] in '0123456789':
|
||||
return float(size_str[:-1])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user