summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Validation.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-02-13 16:41:51 +0100
committerYorhel <git@yorhel.nl>2020-02-13 16:41:53 +0100
commitb95cccca4533846f5784007dea969629510e92f7 (patch)
tree7f51f43a308216e953e46a3cb3743c392ec811fa /lib/VNWeb/Validation.pm
parentcc9965cc9e081ff1c1c0ff065f9c5ffcc744cb86 (diff)
Validation: Actually honor spoiler preference if no view= parameter is set
Subtle bug: I had assumed $1 to be undef if the spoiler wasn't set in the view= parameter, but I put the '?' within the capture group so it would match an empty string... so $1 was an empty string rather than undef.
Diffstat (limited to 'lib/VNWeb/Validation.pm')
-rw-r--r--lib/VNWeb/Validation.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/VNWeb/Validation.pm b/lib/VNWeb/Validation.pm
index b8f1bcdc..d77fc54a 100644
--- a/lib/VNWeb/Validation.pm
+++ b/lib/VNWeb/Validation.pm
@@ -188,7 +188,7 @@ sub can_edit {
# s/S -> 1/0 traits_sexual
# Missing flags will use default.
sub viewget {
- (tuwf->reqGet('view')) =~ /^([0-2]?)([sS]?)$/;
+ (tuwf->reqGet('view')) =~ /^([0-2])?([sS]?)$/;
{
spoilers => $1 // auth->pref('spoilers') || 0,
traits_sexual => !$2 ? auth->pref('traits_sexual') : $2 eq 's',