Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ortel <[email protected]>
  • Loading branch information
jortel committed Sep 25, 2024
1 parent 79363c1 commit cf65f7e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ func (h FileHandler) create(ctx *gin.Context, name string) (m *model.File, err e
switch mode {
case binding.MIMEMultipartPOSTForm:
m, err = h.createMultipart(ctx, name)
case binding.MIMEYAML:
m, err = h.createBody(ctx, name, binding.MIMEYAML)
default:
m, err = h.createBody(ctx, name)
m, err = h.createBody(ctx, name, binding.MIMEJSON)
}
return
}
Expand Down Expand Up @@ -255,10 +257,10 @@ func (h FileHandler) createMultipart(ctx *gin.Context, name string) (m *model.Fi
}

// create a file with request body.
func (h FileHandler) createBody(ctx *gin.Context, name string) (m *model.File, err error) {
func (h FileHandler) createBody(ctx *gin.Context, name, encoding string) (m *model.File, err error) {
m = &model.File{}
m.Name = name
m.Encoding = binding.MIMEYAML
m.Encoding = encoding
m.CreateUser = h.BaseHandler.CurrentUser(ctx)
db := h.DB(ctx)
err = db.Create(&m).Error
Expand Down

0 comments on commit cf65f7e

Please sign in to comment.