🐛 Bug fixes

This commit is contained in:
2024-06-01 22:15:41 +08:00
parent 2b131982b8
commit a1aa418496
3 changed files with 9 additions and 10 deletions

View File

@ -40,7 +40,11 @@ func openAttachment(c *fiber.Ctx) error {
case models.DestinationTypeLocal:
var destConfigured models.LocalDestination
_ = jsoniter.Unmarshal(rawDest, &destConfigured)
return c.SendFile(filepath.Join(destConfigured.Path, metadata.Uuid))
if len(metadata.MimeType) > 0 {
c.Set(fiber.HeaderContentType, metadata.MimeType)
}
return c.SendFile(filepath.Join(destConfigured.Path, metadata.Uuid), false)
case models.DestinationTypeS3:
var destConfigured models.S3Destination
_ = jsoniter.Unmarshal(rawDest, &destConfigured)
@ -52,6 +56,7 @@ func openAttachment(c *fiber.Ctx) error {
destConfigured.Endpoint,
url.QueryEscape(filepath.Join(destConfigured.Path, metadata.Uuid)),
))
default:
return fmt.Errorf("invalid destination: unsupported protocol %s", destParsed.Type)
}