1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-07-21 02:12:49 +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" "fmt"
"io" "io"
"log" "log"
"bytes"
"mime/multipart" "mime/multipart"
"os" "os"
"path/filepath" "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 { if err, errtitle := CanEdit(u, h); err != nil {
return hop.WithErrAbort(err), errtitle 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" return hop.WithErrAbort(errors.New("No data passed")), "Empty"
} }