This is pretty bad as I am unable to click on the question at all, meaning I cannot edit or even delete the question. The only way is to manually delete it from the database.
Possible error
No validation on both ends result in the request title being ' ', which will be considered a string and hence why it bypassed the error that the add question had in #16.
Proposed fix
Quick fix: add .trim() to every field
Longer fix: reuse validateQuestionFields for edit question, though the function needs to be fixed first (see #16). Considering now the frontend passes all the fields for both add & update, there's no real difference in behavior between the two in regards to validation checking.
Problem
Before: Change title to a white space: After:
This is pretty bad as I am unable to click on the question at all, meaning I cannot edit or even delete the question. The only way is to manually delete it from the database.
Possible error
No validation on both ends result in the request title being
' '
, which will be considered a string and hence why it bypassed the error that the add question had in #16.Proposed fix
Quick fix: add
.trim()
to every fieldLonger fix: reuse
validateQuestionFields
for edit question, though the function needs to be fixed first (see #16). Considering now the frontend passes all the fields for both add & update, there's no real difference in behavior between the two in regards to validation checking.