新增 兼容encode过的下载url

This commit is contained in:
moux1024 2025-10-14 19:13:37 +08:00
parent 4a1362d626
commit 7beab504af

View File

@ -80,15 +80,14 @@ export function createScreenAdapter(): void {
export const downloadVideo = async (url: string) => {
try {
const modifyUrl = decodeURIComponent(url);
const response = await fetch(modifyUrl);
const response = await fetch(url);
const blob = await response.blob();
const blobUrl = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = blobUrl;
let filename = 'video.mp4';
try {
const parsed = new URL(modifyUrl);
const parsed = new URL(decodeURIComponent(url));
filename = parsed.pathname.split('/').pop() || 'video.mp4';
if (filename.includes('?')) filename = filename.split('?')[0];
if (filename.includes('#')) filename = filename.split('#')[0];