Add proxy downloads and bulk file operations
- Implement proxy download endpoint for better mobile Safari compatibility - Add bulk selection with checkboxes in file browser - Add bulk actions bar for downloading/deleting selected files - Replace direct S3 downloads with server-proxied downloads - Fix download issues on mobile devices by using proper link handling
This commit is contained in:
@@ -204,14 +204,12 @@ const downloadFile = async () => {
|
||||
if (!props.file) return;
|
||||
|
||||
try {
|
||||
const response = await $fetch('/api/files/download', {
|
||||
params: { fileName: props.file.name },
|
||||
});
|
||||
// Use proxy download endpoint for better mobile compatibility
|
||||
const proxyUrl = `/api/files/proxy-download?fileName=${encodeURIComponent(props.file.name)}`;
|
||||
|
||||
// For mobile Safari, we need to use a different approach
|
||||
// Create a link element
|
||||
const link = document.createElement('a');
|
||||
link.href = response.url;
|
||||
link.target = '_blank';
|
||||
link.href = proxyUrl;
|
||||
|
||||
// Extract clean filename for download
|
||||
let filename = props.file.displayName;
|
||||
@@ -220,9 +218,14 @@ const downloadFile = async () => {
|
||||
}
|
||||
|
||||
link.download = filename;
|
||||
link.style.display = 'none';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
|
||||
// Clean up
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(link);
|
||||
}, 100);
|
||||
} catch (err) {
|
||||
console.error('Failed to download file:', err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user