Improve undefined error in EULA. (#17187)

Signed-off-by: Craig Osterhout <craig.osterhout@docker.com>
This commit is contained in:
Craig Osterhout 2023-05-02 08:48:44 -07:00 committed by GitHub
parent ad838307d7
commit 59bcc82aba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 2 deletions

View File

@ -190,11 +190,24 @@ $(document).ready(function () {
}); });
}); });
// Store the original modal body content in a variable
var originalModalBody = $('#accept-eula .modal-body').html();
function initAcceptEULAModal() { function initAcceptEULAModal() {
$("main").on("click", "a.accept-eula", function (e) { $("main").on("click", "a.accept-eula", function (e) {
e.preventDefault(); e.preventDefault();
_("#accept-eula .btn-primary").href = e.target.href; // Check for undefined. Occurs when loaded via proxy.
$('#accept-eula').modal('show') if (e.target.href && e.target.href !== 'undefined') {
$("#accept-eula .btn-primary").attr('href', e.target.href);
$('#accept-eula .modal-body').html(originalModalBody);
$("#accept-eula .btn-primary").show();
} else {
var errorMessage = 'Unable to process the download link. If you are using a proxy, like a translation service, try accessing the the page without using the proxy.';
$('#accept-eula .modal-body').html('<div class="alert alert-danger">' + errorMessage + '</div>');
$("#accept-eula .btn-primary").hide();
}
$('#accept-eula').modal('show');
}); });
} }