From 443007919a6f96386c34aecc860ac667268dfb47 Mon Sep 17 00:00:00 2001 From: Levi Date: Fri, 19 Apr 2024 22:39:47 +0800 Subject: [PATCH] fix: ignore blob:// and data:// url (#23) --- background/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/background/index.ts b/background/index.ts index a16b8f9..febe317 100644 --- a/background/index.ts +++ b/background/index.ts @@ -83,6 +83,9 @@ export async function checkServer(server: Server): Promise { const downloadEvent = chrome.downloads.onDeterminingFilename || chrome.downloads.onCreated downloadEvent.addListener(async function (item) { + const finalUrl = item.finalUrl || item.url + if (finalUrl.startsWith("blob:") || finalUrl.startsWith("data:")) return + const server = await getSelectedServer() if (!server) return @@ -94,7 +97,7 @@ downloadEvent.addListener(async function (item) { const asset = { filename: path.basename(item.filename.replaceAll("\\", "/")), filesize: item.fileSize, - finalUrl: item.finalUrl || item.url + finalUrl } chrome.windows.getCurrent((currentWindow) => { const width = 480