Split the string ourselves
I don't know what I thought replace did, but the third argument is a count, not a start.
This commit is contained in:
1 parent
0c5836d466
commit
41c1b74c75
1 file changed
+2
-2
@@ -8,7 +8,7 @@ register = template.Library()
|
||||
@register.filter(is_safe=True)
|
||||
def bytesformat(input):
|
||||
output = filesizeformat(input)
|
||||
if not (output and output.endswith('B')):
|
||||
if not (output and output.endswith('B', -1)):
|
||||
return output
|
||||
return output.replace('B', 'iB', -1)
|
||||
return output[: -1 ] + output[ -1 :].replace('B', 'iB', 1)
|
||||
|
||||
Reference in new issue
Block a user