Remove suffix, don't alert on download cancel

This commit is contained in:
2026-08-06 16:30:01 -05:00
parent fecc87cd66
commit f07e9f9c3a
7 changed files with 39 additions and 11 deletions

View File

@@ -9,6 +9,11 @@ function setStatus(message) {
statusEl.textContent = message;
}
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 entryLabel(entry) {
return entry && entry.fullUrl ? "full candidate" : "preview fallback";
}
@@ -115,6 +120,9 @@ function buildRow(entry) {
download.addEventListener("click", async () => {
const result = await browser.runtime.sendMessage({ type: "DOWNLOAD_ENTRY", entry });
if (!result || !result.ok) {
if (isUserCancelledError(result)) {
return;
}
window.alert((result && result.error) || "Download failed.");
return;
}