Archived
1
0

add check for short posts

This commit is contained in:
Jeff 2018-06-05 13:34:36 -04:00
parent 5ea16f369a
commit d5e0f7d698
2 changed files with 13 additions and 0 deletions

View File

@ -680,6 +680,13 @@ func (self *httpFrontend) handle_postRequest(pr *postRequest, b bannedFunc, e er
e(err)
return
}
if !hasAtLeastNWords(m, 3) {
err = errors.New("your message is too short")
e(err)
return
}
nntp := new(nntpArticle)
defer nntp.Reset()
var banned bool

View File

@ -800,3 +800,9 @@ func storeMessage(daemon *NNTPDaemon, hdr textproto.MIMEHeader, body io.Reader)
}
return
}
func hasAtLeastNWords(str string, n int) bool {
parts := strings.Split(str, " ")
return len(parts) > n
}