mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-05-09 01:16:46 +02:00
logging
This commit is contained in:
parent
0a9a846a33
commit
9b79aab4d5
@ -1452,15 +1452,24 @@ class LibraryController {
|
|||||||
|
|
||||||
const filename = `LibraryItems-${Date.now()}.zip`
|
const filename = `LibraryItems-${Date.now()}.zip`
|
||||||
const libraryItemPaths = libraryItems.map((li) => li.path)
|
const libraryItemPaths = libraryItems.map((li) => li.path)
|
||||||
|
|
||||||
console.log(libraryItemPaths)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await zipHelpers.zipDirectoriesPipe(libraryItemPaths, filename, res)
|
await zipHelpers.zipDirectoriesPipe(libraryItemPaths, filename, res)
|
||||||
Logger.info(`[LibraryItemController] Downloaded item "${filename}" at "${libraryItemPaths}"`)
|
Logger.info(`[LibraryItemController] Downloaded item "${filename}" at "${libraryItemPaths}"`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(`[LibraryItemController] Download failed for item "${filename}" at "${libraryItemPaths}"`, 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')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user