Commit d7c3924f authored by sajolida's avatar sajolida
Browse files

Fix URL of mirror being mangled on failure (#15443)

replaceUrlPrefixWithRandomMirror() is not meant to be called twice on
the same elements and this leads to the URL of the mirror being mangled.

This commit introduces another class (.use-mirror-pool-on-retry) on
which replaceUrlPrefixWithRandomMirror() is called when the verification
fails. The download button with .use-mirror-pool gets hidden and
replaced by one with .use-mirror-pool-on-retry.

This not very elegant but probably the simplest solution.
parent 6d9e8bf1
......@@ -216,7 +216,10 @@ document.addEventListener("DOMContentLoaded", function() {
}
else if (result === "failed") {
show(document.getElementById("verification-failed"));
replaceUrlPrefixWithRandomMirror(document.querySelectorAll(".use-mirror-pool")); // Try again with different mirrors
// Try again with different mirrors
toggleDisplay(document.getElementsByClassName("use-mirror-pool"), "hide");
toggleDisplay(document.getElementsByClassName("use-mirror-pool-on-retry"), "show");
replaceUrlPrefixWithRandomMirror(document.querySelectorAll(".use-mirror-pool-on-retry"));
}
else if (result === "failed-again") {
show(document.getElementById("verification-failed-again"));
......
......@@ -12,6 +12,7 @@
<div id="step-download-iso">
<h3><span class="step-number"><span class="debian windows linux mac-usb mac-dvd upgrade-tails">1.</span>1</span>Download Tails</h3>
<a href="[[!inline pages="inc/stable_amd64_iso_url" raw="yes" sort="age"]]" id="download-iso" class="use-mirror-pool btn btn-primary inline-block indent">Download Tails [[!inline pages="inc/stable_amd64_version" raw="yes" sort="age"]] ISO image (<span class="remove-extra-space">[[!inline pages="inc/stable_amd64_iso_size" raw="yes" sort="age"]]</span>)</a>
<a href="[[!inline pages="inc/stable_amd64_iso_url" raw="yes" sort="age"]]" id="download-iso" class="use-mirror-pool-on-retry btn btn-primary inline-block indent">Download Tails [[!inline pages="inc/stable_amd64_version" raw="yes" sort="age"]] ISO image (<span class="remove-extra-space">[[!inline pages="inc/stable_amd64_iso_size" raw="yes" sort="age"]]</span>)</a>
<p id="already-downloaded" class="indent"><a>I already downloaded Tails <span class="remove-extra-space">&nbsp;[[!inline pages="inc/stable_amd64_version" raw="yes" sort="age"]]</span>.</a></p>
</div>
......@@ -86,7 +87,7 @@
<p>[[How does the extension work?|contribute/design/verification_extension]]</p>
"""]]
</div>
<p><a href="[[!inline pages="inc/stable_amd64_iso_url" raw="yes" sort="age"]]" id="download-iso-again" class="use-mirror-pool">Please try to download again&hellip;</a></p>
<p><a href="[[!inline pages="inc/stable_amd64_iso_url" raw="yes" sort="age"]]" id="download-iso-again" class="use-mirror-pool-on-retry">Please try to download again&hellip;</a></p>
</div>
<div id="verification-failed-again" class="block">
<p><b>Verification failed again!</b></p>
......
......@@ -23,7 +23,8 @@ h1 {
#verification-failed-again,
#skip-download-direct,
#skip-download-bittorrent,
#extension-version {
#extension-version,
.use-mirror-pool-on-retry {
display: none;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment