fix file down

This commit is contained in:
张 元山 2025-05-23 15:42:02 +08:00
parent a318455eda
commit 9e2833cdee

View File

@ -109,7 +109,14 @@ const handleDownload = (url) => {
// a // a
const link = document.createElement("a"); const link = document.createElement("a");
link.href = url; link.href = url;
link.download = url.split("/").pop(); // URL
//
let fileName = url.split("/").pop();
//
if (fileName.includes("?") || fileName.includes("_t=")) {
fileName = fileName.split(/[?_]/)[0];
}
link.download = fileName;
link.target = "_blank"; link.target = "_blank";
// //