mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-06-01 19:01:37 +00:00
fix: fall back to application/octet-stream when the file has no mime type stored
This commit is contained in:
@@ -204,8 +204,14 @@ func GetTaskAttachment(c *echo.Context) error {
|
||||
_ = s.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
mimeToReturn := taskAttachment.File.Mime
|
||||
if mimeToReturn == "" {
|
||||
mimeToReturn = "application/octet-stream"
|
||||
}
|
||||
|
||||
c.Response().Header().Set("Content-Disposition", "attachment; filename=\""+taskAttachment.File.Name+"\"")
|
||||
c.Response().Header().Set("Content-Type", taskAttachment.File.Mime)
|
||||
c.Response().Header().Set("Content-Type", mimeToReturn)
|
||||
c.Response().Header().Set("Content-Length", strconv.FormatUint(taskAttachment.File.Size, 10))
|
||||
c.Response().Header().Set("Last-Modified", taskAttachment.File.Created.UTC().Format(http.TimeFormat))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user