This commit is contained in:
Vito0912 2025-03-17 19:58:55 +01:00
parent 0a9a846a33
commit 9b79aab4d5
No known key found for this signature in database
GPG Key ID: 29A3D509FE70B237

View File

@ -1452,15 +1452,24 @@ class LibraryController {
const filename = `LibraryItems-${Date.now()}.zip`
const libraryItemPaths = libraryItems.map((li) => li.path)
console.log(libraryItemPaths)
try {
await zipHelpers.zipDirectoriesPipe(libraryItemPaths, filename, res)
Logger.info(`[LibraryItemController] Downloaded item "${filename}" at "${libraryItemPaths}"`)
} catch (error) {
Logger.error(`[LibraryItemController] Download failed for item "${filename}" at "${libraryItemPaths}"`, error)
//LibraryItemController.handleDownloadError(error, res)
LibraryController.handleDownloadError(error, res)
}
}
static handleDownloadError(error, res) {
if (!res.headersSent) {
if (error.code === 'ENOENT') {
return res.status(404).send('File not found')
} else {
return res.status(500).send('Download failed')
}
}
}