summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-08-31 09:00:13 +0200
committerYorhel <git@yorhel.nl>2020-08-31 09:00:13 +0200
commitc73730ee24f6e72e68b0670decff03e3cee29789 (patch)
tree1887576bf11a7a263e4044419534a16a08705d74
parent537c335f9df183398aee435246afefb322069aa7 (diff)
Discussions/Reviews: Return 404 when requested post or comment does not exist
-rw-r--r--lib/VNWeb/Discussions/Thread.pm2
-rw-r--r--lib/VNWeb/Reviews/Page.pm1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/VNWeb/Discussions/Thread.pm b/lib/VNWeb/Discussions/Thread.pm
index 3712826d..bafe5449 100644
--- a/lib/VNWeb/Discussions/Thread.pm
+++ b/lib/VNWeb/Discussions/Thread.pm
@@ -180,7 +180,7 @@ TUWF::get qr{/$RE{tid}(?:(?<sep>[\./])$RE{num})?}, sub {
WHERE tp.tid =', \$id, '
ORDER BY tp.num'
);
- return tuwf->resNotFound if !@$posts;
+ return tuwf->resNotFound if !@$posts || ($num && !grep $_->{num} == $num, @$posts);
my $poll_options = $t->{poll_question} && tuwf->dbAlli(
'SELECT tpo.id, tpo.option, count(u.id) as votes, tpm.optid IS NOT NULL as my
diff --git a/lib/VNWeb/Reviews/Page.pm b/lib/VNWeb/Reviews/Page.pm
index 9d7e894f..35557c3c 100644
--- a/lib/VNWeb/Reviews/Page.pm
+++ b/lib/VNWeb/Reviews/Page.pm
@@ -107,6 +107,7 @@ TUWF::get qr{/$RE{wid}(?:(?<sep>[\./])$RE{num})?}, sub {
WHERE rp.id =', \$id, '
ORDER BY rp.num'
);
+ return tuwf->resNotFound if $num && !grep $_->{num} == $num, @$posts;
my $title = "Review of $w->{title}";
framework_ title => $title, index => 1, type => 'w', dbobj => $w,