fix: force file downloads via content-disposition attachment
All checks were successful
Automated Container Build / build-and-push (push) Successful in 59s

This commit is contained in:
Elijah 2026-05-26 14:31:36 -07:00
parent a64ba06c2f
commit ed3eed6bb7
2 changed files with 2 additions and 0 deletions

View file

@ -1032,6 +1032,7 @@ func (h *FSHandler) Download(c *fiber.Ctx) error {
// Set appropriate headers for range requests
c.Set("Accept-Ranges", "bytes")
c.Set("Content-Type", mime.TypeByExtension(filepath.Ext(resolvedPath)))
c.Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", info.Name()))
// Use Fiber's built-in SendFile which supports Range requests
return c.SendFile(resolvedPath)

View file

@ -417,5 +417,6 @@ func (h *ShareHandler) DownloadPublicShare(c *fiber.Ctx) error {
return nil
}
c.Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", info.Name()))
return c.SendFile(fullPath)
}