mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-31 22:32:25 -05:00
sanitize html for statuses + instance (#97)
* sanitize html for statuses + instance * sanitization
This commit is contained in:
parent
846057f0d6
commit
bdba3ff9a9
12 changed files with 99 additions and 36 deletions
|
|
@ -50,7 +50,8 @@ func (p *processor) Update(account *gtsmodel.Account, form *apimodel.UpdateCrede
|
|||
if err := util.ValidateDisplayName(*form.DisplayName); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := p.db.UpdateOneByID(account.ID, "display_name", *form.DisplayName, >smodel.Account{}); err != nil {
|
||||
displayName := util.RemoveHTML(*form.DisplayName) // no html allowed in display name
|
||||
if err := p.db.UpdateOneByID(account.ID, "display_name", displayName, >smodel.Account{}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
|
@ -59,7 +60,8 @@ func (p *processor) Update(account *gtsmodel.Account, form *apimodel.UpdateCrede
|
|||
if err := util.ValidateNote(*form.Note); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := p.db.UpdateOneByID(account.ID, "note", *form.Note, >smodel.Account{}); err != nil {
|
||||
note := util.SanitizeHTML(*form.Note) // html OK in note but sanitize it
|
||||
if err := p.db.UpdateOneByID(account.ID, "note", note, >smodel.Account{}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue