- commit
- e9e9163
- parent
- 9f9f7bc
- author
- Eric Bower
- date
- 2023-10-05 13:34:39 +0000 UTC
fix(imgs): regression with upload changes
2 files changed,
+7,
-7
+6,
-6
1@@ -34,11 +34,11 @@ func getUser(s ssh.Session) (*db.User, error) {
2
3 type PostMetaData struct {
4 *db.Post
5- OrigText []byte
6- Cur *db.Post
7- Tags []string
8- User *db.User
9- FileEntry *utils.FileEntry
10+ OrigText []byte
11+ Cur *db.Post
12+ Tags []string
13+ User *db.User
14+ *utils.FileEntry
15 }
16
17 type UploadImgHandler struct {
18@@ -120,7 +120,7 @@ func (h *UploadImgHandler) List(s ssh.Session, fpath string) ([]os.FileInfo, err
19 var post *db.Post
20 var posts []*db.Post
21
22- if cleanFilename == "" || cleanFilename == "." {
23+ if cleanFilename == "" || cleanFilename == "." || cleanFilename == "/" {
24 name := cleanFilename
25 if name == "" {
26 name = "/"
+1,
-1
1@@ -26,7 +26,7 @@ func (h *UploadImgHandler) validateImg(data *PostMetaData) (bool, error) {
2 return false, fmt.Errorf("ERROR: user (%s) has exceeded (%d bytes) max (%d bytes)", data.User.Name, totalFileSize, maxSize)
3 }
4
5- if !shared.IsExtAllowed(data.Filename, h.Cfg.AllowedExt) {
6+ if !shared.IsExtAllowed(data.Filepath, h.Cfg.AllowedExt) {
7 extStr := strings.Join(h.Cfg.AllowedExt, ",")
8 err := fmt.Errorf(
9 "ERROR: (%s) invalid file, format must be (%s), skipping",