Skip to content

Commit

Permalink
Merge pull request #3565 from mikiher/handle-download-errors-2
Browse files Browse the repository at this point in the history
Fix incorrect call to handleDownloadError
  • Loading branch information
advplyr authored Oct 29, 2024
2 parents 6eba467 + 524cf5e commit 5e2aebc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/controllers/LibraryItemController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 5e2aebc

Please sign in to comment.