mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-05-05 12:22:35 +02:00
Add comments under posts and fix user profile
This commit is contained in:
parent
4c4481393d
commit
e86526761c
13 changed files with 201 additions and 42 deletions
|
@ -89,14 +89,14 @@ func (rt *_router) PostComment(w http.ResponseWriter, r *http.Request, ps httpro
|
|||
}
|
||||
|
||||
// check if the comment is valid (should not contain newlines and at be between 5 and 255 characters)
|
||||
stat, err := regexp.Match(`^[*]{5, 255}$`, []byte(request_body.Comment))
|
||||
stat, err := regexp.Match(`^(.*)*`, []byte(request_body.Comment))
|
||||
|
||||
if err != nil {
|
||||
helpers.SendInternalError(err, "Error matching regex", w, rt.baseLogger)
|
||||
return
|
||||
}
|
||||
|
||||
if !stat {
|
||||
if !stat || len(request_body.Comment) < 5 || len(request_body.Comment) > 255 {
|
||||
helpers.SendBadRequest(w, "Invalid comment", rt.baseLogger)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue