mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 04:17:23 +00:00
fix downloading file
This commit is contained in:
11
main.go
11
main.go
@@ -10,9 +10,14 @@ import (
|
||||
"github.com/gofiber/fiber/v3/middleware/logger"
|
||||
)
|
||||
|
||||
const (
|
||||
debugMode = true
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := fiber.New(fiber.Config{
|
||||
BodyLimit: 8 * 1024 * 1024,
|
||||
BodyLimit: 8 * 1024 * 1024,
|
||||
TrustProxy: true,
|
||||
})
|
||||
|
||||
app.Use(logger.New(logger.Config{
|
||||
@@ -23,7 +28,9 @@ func main() {
|
||||
|
||||
app.Use(middleware.JwtMiddleware)
|
||||
|
||||
app.Use(cors.New(cors.ConfigDefault))
|
||||
if debugMode {
|
||||
app.Use(cors.New(cors.ConfigDefault))
|
||||
}
|
||||
|
||||
apiG := app.Group("/api")
|
||||
{
|
||||
|
@@ -190,7 +190,8 @@ func deleteFile(c fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func downloadFile(c fiber.Ctx) error {
|
||||
s, filename, err := service.DownloadFile(c.Params("id"))
|
||||
ip := c.IP()
|
||||
s, filename, err := service.DownloadFile(ip, c.Params("id"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user