mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-04-25 01:16:40 +02:00
Fix server crash when feed cover image is requested but doesnt exist
This commit is contained in:
parent
9e54b4f7ca
commit
ed3af5bdcd
@ -246,6 +246,15 @@ class RssFeedManager {
|
||||
const extname = Path.extname(feed.coverPath).toLowerCase().slice(1)
|
||||
res.type(`image/${extname}`)
|
||||
const readStream = fs.createReadStream(feed.coverPath)
|
||||
|
||||
readStream.on('error', (error) => {
|
||||
Logger.error(`[RssFeedManager] Error streaming cover image: ${error.message}`)
|
||||
// Only send error if headers haven't been sent yet
|
||||
if (!res.headersSent) {
|
||||
res.sendStatus(404)
|
||||
}
|
||||
})
|
||||
|
||||
readStream.pipe(res)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user