1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00

Allow empty content for an attachful hypha

This commit is contained in:
Umar Getagazov 2021-09-29 21:54:25 +07:00
parent 44f6fbe0b2
commit 6636fc95a7

View File

@ -5,6 +5,7 @@ import (
"fmt"
"io"
"log"
"bytes"
"mime/multipart"
"os"
"path/filepath"
@ -35,7 +36,7 @@ func UploadText(h *hyphae.Hypha, data []byte, message string, u *user.User) (hop
if err, errtitle := CanEdit(u, h); err != nil {
return hop.WithErrAbort(err), errtitle
}
if len(data) == 0 {
if len(bytes.TrimSpace(data)) == 0 && h.BinaryPath == "" {
return hop.WithErrAbort(errors.New("No data passed")), "Empty"
}