Compare commits

..
Author SHA1 Message Date
Graham Steffaniak 7eda40a77a patch stable download delay 2025-12-02 09:18:07 -06:00
2 changed files with 12 additions and 45 deletions

No files matched your search

+5
View File
@@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file. For commit guidelines, please refer to [Standard Version](https://github.com/conventional-changelog/standard-version).
## v1.0.3-stable
**BugFixes**:
- download progress is not shown #1687
## v1.0.2-stable
**Notes**:
+7 -45
View File
@@ -102,56 +102,18 @@ export async function download(format, files, shareHash = "") {
files: fileargs,
algo: format,
hash: shareHash,
...(state.share.token && { token: state.share.token })
...(state.share.token && { token: state.share.token }),
sessionId: state.sessionId
})
const url = window.origin + apiPath
// Use fetch to capture errors in the console
const response = await fetch(url, {
credentials: 'same-origin',
headers: {
"sessionId": state.sessionId,
},
})
if (!response.ok) {
const errorText = await response.text()
const error = new Error(`Download failed: ${response.status} ${response.statusText}`)
console.error('Download API error:', {
status: response.status,
statusText: response.statusText,
body: errorText,
url: url
})
throw error
}
// Get the blob from the response
const blob = await response.blob()
// Determine filename from Content-Disposition header or use default
let filename = 'download'
const contentDisposition = response.headers.get('Content-Disposition')
if (contentDisposition) {
const filenameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/)
if (filenameMatch && filenameMatch[1]) {
filename = filenameMatch[1].replace(/['"]/g, '')
}
} else {
// Fallback: use format extension
filename = `download.${format}`
}
// Create a blob URL and trigger download
const blobUrl = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = blobUrl
link.setAttribute('download', filename)
link.href = url
link.style.display = 'none'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
// Clean up the blob URL
window.URL.revokeObjectURL(blobUrl)
setTimeout(() => {
document.body.removeChild(link)
}, 100)
}
export function post(