Merge pull request #235 from TheNain38/patch-1

Fix error when opening menu if file size is null
This commit is contained in:
ZeroNet 2016-01-16 21:32:28 +01:00
commit 2121612a72

View file

@ -144,7 +144,10 @@ class UiWebsocketPlugin(object):
else: else:
size = size_filetypes.get(extension, 0) size = size_filetypes.get(extension, 0)
size_other -= size size_other -= size
percent = 100 * (float(size) / size_total) if size_total == 0:
percent = 0
else:
percent = 100 * (float(size) / size_total)
body.append(u"<li style='width: %.2f%%' class='%s back-%s' title='%s'></li>" % (percent, extension, color, extension)) body.append(u"<li style='width: %.2f%%' class='%s back-%s' title='%s'></li>" % (percent, extension, color, extension))
# Legend # Legend