Merge pull request #3565 from mikiher/handle-download-errors-2

Fix incorrect call to handleDownloadError
This commit is contained in:
advplyr 2024-10-29 15:55:37 -05:00 committed by GitHub
commit 5e2aebc724
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,7 +115,7 @@ class LibraryItemController {
res.sendStatus(200)
}
#handleDownloadError(error, res) {
static handleDownloadError(error, res) {
if (!res.headersSent) {
if (error.code === 'ENOENT') {
return res.status(404).send('File not found')
@ -158,7 +158,7 @@ class LibraryItemController {
Logger.info(`[LibraryItemController] Downloaded item "${itemTitle}" at "${libraryItemPath}"`)
} catch (error) {
Logger.error(`[LibraryItemController] Download failed for item "${itemTitle}" at "${libraryItemPath}"`, error)
this.#handleDownloadError(error, res)
LibraryItemController.handleDownloadError(error, res)
}
}
@ -865,7 +865,7 @@ class LibraryItemController {
Logger.info(`[LibraryItemController] Downloaded file "${libraryFile.metadata.path}"`)
} catch (error) {
Logger.error(`[LibraryItemController] Failed to download file "${libraryFile.metadata.path}"`, error)
this.#handleDownloadError(error, res)
LibraryItemController.handleDownloadError(error, res)
}
}
@ -909,7 +909,7 @@ class LibraryItemController {
Logger.info(`[LibraryItemController] Downloaded ebook file "${ebookFilePath}"`)
} catch (error) {
Logger.error(`[LibraryItemController] Failed to download ebook file "${ebookFilePath}"`, error)
this.#handleDownloadError(error, res)
LibraryItemController.handleDownloadError(error, res)
}
}