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:
tcely authored and GitHub committed 2025-01-25 05:41:34 -05:00
1 parent 0c5836d466
commit 41c1b74c75
1 file changed
+2 -2
+2 -2
View File
@@ -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)