Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wiseai-go opened this issue Mar 23, 2023 · 1 comment

Comments

@wiseai-go
Copy link

// 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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant