From b98b525e165e5242627f515dfce8530cff7cbb9a Mon Sep 17 00:00:00 2001 From: Eric Fahlgren Date: Thu, 29 May 2025 08:51:14 -0700 Subject: [PATCH] luci-app-attendedsysupgrade: avoid redirects, handle redirect errors When users add an extraneous slash to the server url, then the ASU server redirects GET requests. But, this causes an error on POST requests as the ASU server does not redirect those, so the LuCI client failed inappropriately with an unhandled error. Fix both of these by first trimming trailing slashes from the server url as it is loaded to avoid the redirects. Then, also handle all unexpected responses, instead of just a select few. Links: efahl/owut@724c990d6cc0 Signed-off-by: Eric Fahlgren --- .../resources/view/attendedsysupgrade/overview.js | 8 +++----- 1 file changed, 3 insertions(+), 5 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 148ef97e3b..579385d158 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 @@ -338,19 +338,17 @@ return view.extend({ } } break; - case 400: // bad request - case 422: // bad package - case 500: // build failed + default: // any error or unexpected responses if (main == true) { poll.remove(this.pollFn); this.handleError(response, data, firmware); - break; } else { poll.remove(this.rebuilder_polls[server]); document.getElementById(server).innerText = '🚫 %s'.format( server ); } + break; } }); }, @@ -632,7 +630,7 @@ return view.extend({ uci.load('attendedsysupgrade'), ]); const data = { - url: uci.get_first('attendedsysupgrade', 'server', 'url'), + url: uci.get_first('attendedsysupgrade', 'server', 'url').replace(/\/+$/, ''), branch: get_branch(promises[1].release.version), revision: promises[1].release.revision, efi: promises[2],