diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-07-22 10:20:42 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-07-22 10:29:11 +0200 |
commit | d2d3738d9046339d6374a5957cb790d0d9d62456 (patch) | |
tree | b46965cc149f96bf74475716d1c2d03896aeb60d /modules/luci-mod-system | |
parent | b8ff46c6d6f403b5881f812d91611b6b5b2167ed (diff) |
luci-mod-system: ignore empty /proc/mtd on flash page
A present, but empty /proc/mtd causes validation on the flash page to fail,
preventing any other operation.
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 | 17 |
1 files changed, 11 insertions, 6 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 4a1058d0d..3f2868038 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 @@ -385,16 +385,21 @@ return view.extend({ o.onclick = L.bind(this.handleRestore, this); - if (procmtd.length) { + var mtdblocks = []; + procmtd.split(/\n/).forEach(function(ln) { + var match = ln.match(/^mtd(\d+): .+ "(.+?)"$/); + if (match) + mtdblocks.push(match[1], match[2]); + }); + + if (mtdblocks.length) { o = s.option(form.SectionValue, 'actions', form.NamedSection, 'actions', 'actions', _('Save mtdblock contents'), _('Click "Save mtdblock" to download specified mtdblock file. (NOTE: THIS FEATURE IS FOR PROFESSIONALS! )')); ss = o.subsection; o = ss.option(form.ListValue, 'mtdselect', _('Choose mtdblock')); - procmtd.split(/\n/).forEach(function(ln) { - var match = ln.match(/^mtd(\d+): .+ "(.+?)"$/); - if (match) - o.value(match[1], match[2]); - }); + + for (var i = 0; i < mtdblocks.length; i += 2) + o.value(mtdblocks[i], mtdblocks[i+1]); o = ss.option(form.Button, 'mtddownload', _('Download mtdblock')); o.inputstyle = 'action important'; |