Add jfif as an image file extension.

Add jpeg as jpgs for post attachments.

Move some things.
This commit is contained in:
Azareal 2019-10-30 12:51:23 +10:00
parent d2be6b220e
commit 9e8b95b1be
4 changed files with 4 additions and 5 deletions

View File

@ -66,7 +66,7 @@ var AllowedFileExts = StringList{
"otf", "woff2", "woff", "ttf", "eot", // fonts "otf", "woff2", "woff", "ttf", "eot", // fonts
} }
var ImageFileExts = StringList{ var ImageFileExts = StringList{
"png", "jpg", "jpeg", "svg", "bmp", "gif", "tif", "webp", /* "apng",*/ "png", "jpg", "jpeg","jfif", "svg", "bmp", "gif", "tif", "webp", /* "apng",*/
} }
var ArchiveFileExts = StringList{ var ArchiveFileExts = StringList{
"bz2", "zip", "gz", "7z", "tar", "cab", "bz2", "zip", "gz", "7z", "tar", "cab",

View File

@ -51,8 +51,7 @@ func (s *SQLReplyStore) Get(id int) (*Reply, error) {
// TODO: Write a test for this // TODO: Write a test for this
func (s *SQLReplyStore) Create(t *Topic, content string, ip string, uid int) (rid int, err error) { func (s *SQLReplyStore) Create(t *Topic, content string, ip string, uid int) (rid int, err error) {
wcount := WordCount(content) res, err := s.create.Exec(t.ID, content, ParseMessage(content, t.ParentID, "forums"), ip, WordCount(content), uid)
res, err := s.create.Exec(t.ID, content, ParseMessage(content, t.ParentID, "forums"), ip, wcount, uid)
if err != nil { if err != nil {
return 0, err return 0, err
} }

View File

@ -47,7 +47,7 @@ func ThumbTask(thumbChan chan bool) {
/*if user.RawAvatar == ".gif" { /*if user.RawAvatar == ".gif" {
return nil return nil
}*/ }*/
if user.RawAvatar != ".png" && user.RawAvatar != ".jpg" && user.RawAvatar != ".jpeg" && user.RawAvatar != ".gif" { if user.RawAvatar != ".png" && user.RawAvatar != ".jpg" && user.RawAvatar != ".jpeg" && user.RawAvatar != ".jfif" && user.RawAvatar != ".gif" {
return nil return nil
} }

View File

@ -494,7 +494,7 @@ func uploadFilesWithHash(w http.ResponseWriter, r *http.Request, user c.User, di
} }
defer inFile.Close() defer inFile.Close()
if ext != "jpg" && ext != "png" && ext != "gif" { if ext != "jpg" && ext != "jpeg" && ext != "png" && ext != "gif" {
outFile, err := os.Create(dir + filename) outFile, err := os.Create(dir + filename)
if err != nil { if err != nil {
return nil, c.LocalError("Upload failed [File Creation Failed]", w, r, user) return nil, c.LocalError("Upload failed [File Creation Failed]", w, r, user)