From 1b9316649ddb8d49d625ed77d334d81b4ec48873 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Mon, 10 Oct 2022 12:11:44 -0600 Subject: [PATCH] purge non-alphnumeric characters --- openbsd.app.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openbsd.app.pl b/openbsd.app.pl index 665e493..2183b76 100755 --- a/openbsd.app.pl +++ b/openbsd.app.pl @@ -105,6 +105,13 @@ sub set_query ($is_current) { return sprintf( $query, ("stable_ports_fts") x 4 ); } +sub fix_fts ($s) { + return "" unless defined $s; + $s =~ s/[^\w]/ /g; + return $s; +} + + get '/tree' => sub ($c) { my $v = $c->validation; @@ -131,8 +138,7 @@ get '/tree' => sub ($c) { get '/' => sub ($c) { my $v = $c->validation; - my $search = $c->param('search'); - $search =~ s/[^[:ascii:]]//g; + my $search = fix_fts $c->param('search'); my $current = $c->param('current'); my $format = $c->param('format');