mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-09-11 15:56:22 -07:00
Add filename and username banning, add more de-deprecation stuff to posting/post.go
This commit is contained in:
parent
b69536b772
commit
379e846daf
10 changed files with 531 additions and 405 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"html"
|
||||
"html/template"
|
||||
"time"
|
||||
|
||||
|
@ -231,6 +232,18 @@ func (p *Post) GetUpload() (*Upload, error) {
|
|||
return upload, err
|
||||
}
|
||||
|
||||
// Sanitize escapes HTML strings in a post. This should be run immediately before
|
||||
// the post is inserted into the database
|
||||
func (p *Post) Sanitize() {
|
||||
if !p.sanitized {
|
||||
p.Name = html.EscapeString(p.Name)
|
||||
p.Email = html.EscapeString(p.Email)
|
||||
p.Subject = html.EscapeString(p.Subject)
|
||||
p.Password = html.EscapeString(p.Password)
|
||||
p.sanitized = true
|
||||
}
|
||||
}
|
||||
|
||||
// UnlinkUploads disassociates the post with any uploads in DBPREFIXfiles
|
||||
// that may have been uploaded with it, optionally leaving behind a "File Deleted"
|
||||
// frame where the thumbnail appeared
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue