Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Receiving side comment validation was not working

Validate comment fields and related variables one by one.
  • Loading branch information...
commit 3e26308c8995804b47d7b77189de9d1e4ec4ebd1 1 parent 727ef61
@Petteri authored
Showing with 14 additions and 6 deletions.
  1. +14 −6 index.cgi
View
20 index.cgi
@@ -458,12 +458,20 @@ def handleIncomingComment(fs):
filename = "%s.txt" % name
comments_for_entry = getComments(filename)
- # save and send only valid comments
- if (author and email and comment and \
- name and commentnum and \
- maxcomments > -1 and \
- len(comments_for_entry) < maxcomments and \
- nospam == nospamanswer) is False:
+ # validate comment
+ if not author:
+ return None
+ if not email:
+ return None
+ if not comment:
+ return None
+ if not name:
+ return None
+ if maxcomments == -1: # no comments allowed
+ return None
+ if len(comments_for_entry) >= maxcomments: # no more comments allowed
+ return None
+ if nospam != nospamanswer: # wrong answer
return None
# remove html tags
Please sign in to comment.
Something went wrong with that request. Please try again.