Fix lazy static route with unknown avatars
authorChocobozzz <me@florianbigard.com>
Thu, 22 Aug 2019 12:52:41 +0000 (14:52 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 22 Aug 2019 12:52:41 +0000 (14:52 +0200)
server/controllers/lazy-static.ts

index 28d2f862a59008f3df9f24c5545e830e170772cd..1ff99e90c2830f76ce98ab2b40d105dcd96c88f0 100644 (file)
@@ -44,6 +44,8 @@ async function getAvatar (req: express.Request, res: express.Response) {
   }
 
   const avatar = await AvatarModel.loadByName(filename)
+  if (!avatar) return res.sendStatus(404)
+
   if (avatar.onDisk === false) {
     if (!avatar.fileUrl) return res.sendStatus(404)