新增 兼容encode过的下载url

This commit is contained in:
moux1024 2025-10-14 18:43:10 +08:00
parent a40cacb528
commit 4c1f82d706

View File

@ -80,12 +80,13 @@ export function createScreenAdapter(): void {
export const downloadVideo = async (url: string) => {
try {
const response = await fetch(decodeURIComponent(url));
const modifyUrl = decodeURIComponent(url);
const response = await fetch(modifyUrl);
const blob = await response.blob();
const blobUrl = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = blobUrl;
a.download = url.split('/').pop() || 'video.mp4';
a.download = modifyUrl.split('/').pop() || 'video.mp4';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);