fix: handle query parameters in downloadFile redirect

This commit is contained in:
2025-11-29 12:20:53 +08:00
parent 23269ad9d1
commit 6040f88034

View File

@@ -229,11 +229,14 @@ func downloadFile(c fiber.Ctx) error {
if err != nil {
return err
}
q := uri.Query()
if len(q) != 0 {
return c.Redirect().Status(fiber.StatusFound).To(uri.String())
}
token, err := utils.GenerateDownloadToken(s)
if err != nil {
return err
}
q := uri.Query()
q.Set("token", token)
uri.RawQuery = q.Encode()
return c.Redirect().Status(fiber.StatusFound).To(uri.String())