From 3c40a7450a9b7d340cdc9e233818c63a8092fec2 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 25 Sep 2019 16:23:02 +0200 Subject: luci-mod-system: flash.js: improve storage size detection heuristics Signed-off-by: Jo-Philipp Wich --- .../htdocs/luci-static/resources/view/system/flash.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js index c40a5d3c5a..9ad64dad48 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js @@ -161,24 +161,26 @@ function findStorageSize(procmtd, procpart) { var kernsize = 0, rootsize = 0, wholesize = 0; procmtd.split(/\n/).forEach(function(ln) { - var match = ln.match(/^mtd\d+: ([0-9a-f]+) [0-9a-f]+ "(.+)"$/); + var match = ln.match(/^mtd\d+: ([0-9a-f]+) [0-9a-f]+ "(.+)"$/), + size = match ? parseInt(match[1], 16) : 0; switch (match ? match[2] : '') { case 'linux': case 'firmware': - wholesize = parseInt(match[1], 16); + if (size > wholesize) + wholesize = size; break; case 'kernel': case 'kernel0': - kernsize = parseInt(match[1], 16); + kernsize = size; break; case 'rootfs': case 'rootfs0': case 'ubi': case 'ubi0': - rootsize = parseInt(match[1], 16); + rootsize = size; break; } }); -- cgit v1.2.3