Skip to content

Commit

Permalink
fix: image upload use filename from file
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Jan 30, 2024
1 parent 2b7c8d7 commit e14e0fe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/app/handler/image/image.handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ func NewHandler(service imageSvc.Service, validate validator.IDtoValidator, maxF
// @Failure 503 {object} dto.ResponseServiceDownErr "Service is down"
// @Router /v1/images [post]
func (h *Handler) Upload(c *router.FiberCtx) {
filename := c.GetFormData("filename")
petId := c.GetFormData("petId")
petId := c.GetFormData("pet_id")
file, err := c.File("file", file.AllowContentType, h.maxFileSize)
if err != nil {
log.Error().
Expand All @@ -57,7 +56,7 @@ func (h *Handler) Upload(c *router.FiberCtx) {
}

request := &dto.UploadImageRequest{
Filename: filename,
Filename: file.Filename,
File: file.Data,
PetId: petId,
}
Expand Down
1 change: 0 additions & 1 deletion src/app/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func NewAPIv1(r *FiberRouter, conf config.App) *fiber.App {

func NewFiberRouter(authGuard IGuard, conf config.App) *FiberRouter {
r := fiber.New(fiber.Config{
AppName: "JohnJud API",
BodyLimit: int(conf.MaxFileSize * 1024 * 1024),
})

Expand Down

0 comments on commit e14e0fe

Please sign in to comment.