Skip to content

Commit

Permalink
Merge pull request #3313 from mikiher/author-image-path
Browse files Browse the repository at this point in the history
Update AuthorController to handle invalid image paths and log a warning
  • Loading branch information
advplyr authored Aug 21, 2024
2 parents 7d711da + 20a3657 commit 1c0d6e9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/controllers/AuthorController.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,12 @@ class AuthorController {
author
} = req

if (raw) {
// any value
if (!author.imagePath || !(await fs.pathExists(author.imagePath))) {
return res.sendStatus(404)
}
if (!author.imagePath || !(await fs.pathExists(author.imagePath))) {
Logger.warn(`[AuthorController] Author "${author.name}" has invalid imagePath: ${author.imagePath}`)
return res.sendStatus(404)
}

if (raw) {
return res.sendFile(author.imagePath)
}

Expand Down

0 comments on commit 1c0d6e9

Please sign in to comment.