From 59bcc82aba64ad2c8d55d61b852e807a95623cc0 Mon Sep 17 00:00:00 2001 From: Craig Osterhout <103533812+craig-osterhout@users.noreply.github.com> Date: Tue, 2 May 2023 08:48:44 -0700 Subject: [PATCH] Improve undefined error in EULA. (#17187) Signed-off-by: Craig Osterhout --- assets/js/docs.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/assets/js/docs.js b/assets/js/docs.js index ae07248634..dc5fa7d99e 100644 --- a/assets/js/docs.js +++ b/assets/js/docs.js @@ -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() { $("main").on("click", "a.accept-eula", function (e) { e.preventDefault(); - _("#accept-eula .btn-primary").href = e.target.href; - $('#accept-eula').modal('show') + // Check for undefined. Occurs when loaded via proxy. + 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('
' + errorMessage + '
'); + $("#accept-eula .btn-primary").hide(); + } + $('#accept-eula').modal('show'); }); }