Fixed a bug where comments could be submitted without any content
and where the hitcount was incremented before the program checked if the post existed
This commit is contained in:
@@ -62,15 +62,15 @@ router.get("/user/:username", (req, res) => {
|
||||
router.get("/post/:post_index", (req, res) => {
|
||||
const postID = parseInt(req.params.post_index)
|
||||
let post = data.getdata('posts', postID)
|
||||
if (config.enable_hitcount) {
|
||||
data.increment_hitcount(postID)
|
||||
}
|
||||
if (post == 1) { // data.getdata returns error code 1 if nothing is available
|
||||
res.render("partials/message", {
|
||||
message: locale.post_doesnt_exist,
|
||||
config,
|
||||
})
|
||||
}
|
||||
if (config.enable_hitcount) {
|
||||
data.increment_hitcount(postID)
|
||||
}
|
||||
else if (typeof post["deleted"] == "undefined" || post["deleted"] == false) {
|
||||
res.render("pages/post",
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user