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:
7
main.go
7
main.go
@@ -10,9 +10,14 @@ import (
|
|||||||
"github.com/gofiber/fiber/v3/middleware/logger"
|
"github.com/gofiber/fiber/v3/middleware/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
debugMode = true
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := fiber.New(fiber.Config{
|
app := fiber.New(fiber.Config{
|
||||||
BodyLimit: 8 * 1024 * 1024,
|
BodyLimit: 8 * 1024 * 1024,
|
||||||
|
TrustProxy: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
app.Use(logger.New(logger.Config{
|
app.Use(logger.New(logger.Config{
|
||||||
@@ -23,7 +28,9 @@ func main() {
|
|||||||
|
|
||||||
app.Use(middleware.JwtMiddleware)
|
app.Use(middleware.JwtMiddleware)
|
||||||
|
|
||||||
|
if debugMode {
|
||||||
app.Use(cors.New(cors.ConfigDefault))
|
app.Use(cors.New(cors.ConfigDefault))
|
||||||
|
}
|
||||||
|
|
||||||
apiG := app.Group("/api")
|
apiG := app.Group("/api")
|
||||||
{
|
{
|
||||||
|
@@ -190,7 +190,8 @@ func deleteFile(c fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func downloadFile(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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user