fix: force file downloads via content-disposition attachment
All checks were successful
Automated Container Build / build-and-push (push) Successful in 59s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 59s
This commit is contained in:
parent
a64ba06c2f
commit
ed3eed6bb7
2 changed files with 2 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue