diff --git a/components/FilePreviewModal.vue b/components/FilePreviewModal.vue index b2e12ba..78761d9 100644 --- a/components/FilePreviewModal.vue +++ b/components/FilePreviewModal.vue @@ -208,7 +208,21 @@ const downloadFile = async () => { params: { fileName: props.file.name }, }); - window.open(response.url, '_blank'); + // For mobile Safari, we need to use a different approach + const link = document.createElement('a'); + link.href = response.url; + link.target = '_blank'; + + // Extract clean filename for download + let filename = props.file.displayName; + if (!filename.includes('.') && props.file.extension) { + filename += '.' + props.file.extension; + } + + link.download = filename; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); } catch (err) { console.error('Failed to download file:', err); } diff --git a/pages/dashboard/file-browser.vue b/pages/dashboard/file-browser.vue index 954a173..ae7ade4 100644 --- a/pages/dashboard/file-browser.vue +++ b/pages/dashboard/file-browser.vue @@ -469,8 +469,21 @@ const downloadFile = async (file: FileItem) => { params: { fileName: file.name }, }); - // Open download URL in new tab - window.open(response.url, '_blank'); + // For mobile Safari compatibility, use a link element + const link = document.createElement('a'); + link.href = response.url; + link.target = '_blank'; + + // Extract clean filename for download + let filename = file.displayName; + if (!filename.includes('.') && file.extension) { + filename += '.' + file.extension; + } + + link.download = filename; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); } catch (error) { toast.error('Failed to generate download link'); } finally {