fix blossom upload < 50bytes

This commit is contained in:
andrewheadricke 2025-03-14 15:14:13 +11:00 committed by fiatjaf_
parent 581c4ece28
commit 6cc2477e89

View File

@ -73,7 +73,7 @@ func (bs BlossomServer) handleUpload(w http.ResponseWriter, r *http.Request) {
// read first bytes of upload so we can find out the filetype // read first bytes of upload so we can find out the filetype
b := make([]byte, min(50, size), size) b := make([]byte, min(50, size), size)
if _, err = r.Body.Read(b); err != nil { if n, err := r.Body.Read(b); err != nil && n != size {
blossomError(w, "failed to read initial bytes of upload body: "+err.Error(), 400) blossomError(w, "failed to read initial bytes of upload body: "+err.Error(), 400)
return return
} }