diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-09-25 16:23:02 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-25 16:23:02 +0200 |
commit | 3c40a7450a9b7d340cdc9e233818c63a8092fec2 (patch) | |
tree | b2b1599bc31f8b87440042e1aa38d4393804906f /modules/luci-mod-system | |
parent | 66749b4fe33987b5326bc5d6f5ef4979a230cb49 (diff) |
luci-mod-system: flash.js: improve storage size detection heuristics
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-system')
-rw-r--r-- | modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js | 10 |
1 files 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 c40a5d3c5..9ad64dad4 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; } }); |