Remove suffix, don't alert on download cancel
This commit is contained in:
@@ -4,6 +4,11 @@ const statusEl = document.getElementById("status");
|
||||
const listEl = document.getElementById("historyList");
|
||||
const clearHistoryBtn = document.getElementById("clearHistoryBtn");
|
||||
|
||||
function isUserCancelledError(result) {
|
||||
const error = result && typeof result.error === "string" ? result.error.toLowerCase() : "";
|
||||
return error.includes("canceled by the user") || error.includes("cancelled by the user");
|
||||
}
|
||||
|
||||
function formatMeta(entry) {
|
||||
const packName = entry && entry.packName ? entry.packName : "n/a";
|
||||
const key = entry && entry.key ? entry.key : "n/a";
|
||||
@@ -105,6 +110,9 @@ function buildItem(entry) {
|
||||
entry
|
||||
});
|
||||
if (!result || !result.ok) {
|
||||
if (isUserCancelledError(result)) {
|
||||
return;
|
||||
}
|
||||
window.alert((result && result.error) || "Download failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user