summaryrefslogtreecommitdiff
path: root/lib/VNWeb/TT/TagPage.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-01-10 09:47:08 +0100
committerYorhel <git@yorhel.nl>2021-01-10 09:47:08 +0100
commite991e259e86d863ee8e5e4e73cd4215cab48af4f (patch)
treed8af0e595d102dab411f641e34f41ad8f26408e5 /lib/VNWeb/TT/TagPage.pm
parent5061421becc459f86b758eef5ca45ec4d608e954 (diff)
TagPage: Fix URL compatibility conversion for URLS with a tag filter
Diffstat (limited to 'lib/VNWeb/TT/TagPage.pm')
-rw-r--r--lib/VNWeb/TT/TagPage.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/VNWeb/TT/TagPage.pm b/lib/VNWeb/TT/TagPage.pm
index 9b76e4de..8431419e 100644
--- a/lib/VNWeb/TT/TagPage.pm
+++ b/lib/VNWeb/TT/TagPage.pm
@@ -108,11 +108,16 @@ sub vns_ {
# URL compatibility with old filters
if(!$opt->{f}->{query} && $opt->{fil}) {
my $q = eval {
- tuwf->compile({ advsearch => 'v' })->validate(filter_release_adv filter_parse v => $opt->{fil})->data;
+ my $f = filter_parse v => $opt->{fil};
+ # Old URLs often had the tag ID as part of the filter, let's remove that.
+ $f->{tag_inc} = [ grep $_ != $t->{id}, $f->{tag_inc}->@* ] if $f->{tag_inc};
+ delete $f->{tag_inc} if $f->{tag_inc} && !$f->{tag_inc}->@*;
+ $f = filter_vn_adv $f;
+ tuwf->compile({ advsearch => 'v' })->validate(@$f > 1 ? $f : undef)->data;
};
if(!$q) {
warn "Filter compatibility conversion failed\n$@";
- } else {
+ } elsif($q->{query}) {
return tuwf->resRedirect(tuwf->reqPath().'?'.query_encode(%$opt, fil => undef, f => $q), 'temp');
}
}