Merge pull request #3313 from mikiher/author-image-path

Update AuthorController to handle invalid image paths and log a warning
This commit is contained in:
advplyr 2024-08-21 17:46:39 -05:00 committed by GitHub
commit 1c0d6e9c67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -368,12 +368,12 @@ class AuthorController {
author author
} = req } = req
if (raw) { if (!author.imagePath || !(await fs.pathExists(author.imagePath))) {
// any value Logger.warn(`[AuthorController] Author "${author.name}" has invalid imagePath: ${author.imagePath}`)
if (!author.imagePath || !(await fs.pathExists(author.imagePath))) { return res.sendStatus(404)
return res.sendStatus(404) }
}
if (raw) {
return res.sendFile(author.imagePath) return res.sendFile(author.imagePath)
} }