Compare commits

...

2 Commits

Author SHA1 Message Date
Niko Abeler 0de18e89fc send 404 on messing binary 2023-07-27 20:56:26 +02:00
Niko Abeler 40117dab37 fix crash on missing file 2023-07-27 20:55:50 +02:00
1 changed files with 2 additions and 2 deletions

View File

@ -23,9 +23,9 @@ func (h *MediaHandler) Handle(c *fiber.Ctx) error {
return err
}
binary, err := h.binaryService.FindById(id)
c.Set("Content-Type", binary.Mime())
if err != nil {
return err
return c.SendStatus(fiber.StatusNotFound)
}
c.Set("Content-Type", binary.Mime())
return c.Send(binary.Data)
}