diff options
author | Jakob Haufe <sur5r@sur5r.net> | 2024-02-03 20:22:21 +0100 |
---|---|---|
committer | Paul Spooren <mail@aparcar.org> | 2024-02-05 10:05:31 +0100 |
commit | cb45737d1bf6f89017e2ab557144c524aea2e57e (patch) | |
tree | 5319b24c069df349a349bbd99af76bed345cb257 /applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade | |
parent | 1e1c6b853157febd3d93cdcbaa059a4f1a80b33b (diff) |
luci-app-attendedsysupgrade: Fix logic error in EFI image selection
If a non-EFI image comes first in the list of images, it would have
been selected even on an EFI system.
Signed-off-by: Jakob Haufe <sur5r@sur5r.net>
Diffstat (limited to 'applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade')
-rw-r--r-- | applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js b/applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js index 450af35496..06bc1bb068 100644 --- a/applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js +++ b/applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js @@ -85,24 +85,24 @@ return view.extend({ }, selectImage: function (images) { - let image; - for (image of images) { - if (this.firmware.filesystem == image.filesystem) { + let firmware = this.firmware; + let data = this.data; + var filesystemFilter = function(e) { + return (e.filesystem == firmware.filesystem); + } + var typeFilter = function(e) { + if (firmware.target.indexOf("x86") != -1) { // x86 images can be combined-efi (EFI) or combined (BIOS) - if(this.firmware.target.indexOf("x86") != -1) { - if (this.data.efi && image.type == 'combined-efi') { - return image; - } else if (image.type == 'combined') { - return image; - } + if (data.efi) { + return (e.type == 'combined-efi'); } else { - if (image.type == 'sysupgrade' || image.type == 'combined') { - return image; - } + return (e.type == 'combined'); } + } else { + return (e.type == 'sysupgrade' || e.type == 'combined'); } } - return null; + return images.filter(filesystemFilter).filter(typeFilter)[0]; }, handle200: function (response) { |