gogf / focus-single

Single repo demo project using GoFrame.
GNU Lesser General Public License v3.0
160 stars 64 forks source link

创建内容时,HTML编解码-ghtml只编码第一层,所以创建的内容中可以包含js,建议修改为ghtml.SpecialCharsMapOrStruct(&in.ContentCreateUpdateBase) #16

Open wiseai-go opened 1 year ago

wiseai-go commented 1 year ago

// Create 创建内容 func (s *sContent) Create(ctx context.Context, in model.ContentCreateInput) (out model.ContentCreateOutput, err error) { if in.UserId == 0 { in.UserId = service.BizCtx().Get(ctx).User.Id } // 不允许HTML代码 if err = ghtml.SpecialCharsMapOrStruct(&in.ContentCreateUpdateBase); err != nil { return out, err } lastInsertID, err := dao.Content.Ctx(ctx).Data(in).InsertAndGetId() if err != nil { return out, err } return model.ContentCreateOutput{ContentId: uint(lastInsertID)}, err }

wiseai-go commented 1 year ago

不太会用github,第一次Issues,希望goframe越来越好!!!