#721 search will trim whitespace and handle more MAC formats

This commit is contained in:
Oliver Gorwits
2020-05-24 19:41:21 +01:00
parent ba32ba3f5d
commit 3662899ede
3 changed files with 10 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
2.045006 - 2020-05-24
[ENHANCEMENTS]
* #721 search will trim whitespace and handle more MAC formats
2.045005 - 2020-05-18 2.045005 - 2020-05-18
[BUG FIXES] [BUG FIXES]

View File

@@ -145,6 +145,9 @@ hook 'before' => sub {
$key =~ s|.*/(\w+)/(\w+)$|${1}_${2}|; $key =~ s|.*/(\w+)/(\w+)$|${1}_${2}|;
var(sidebar_key => $key); var(sidebar_key => $key);
# trim whitespace
params->{'q'} =~ s/^\s+|\s+$//g if param('q');
# copy sidebar defaults into vars so we can mess about with it # copy sidebar defaults into vars so we can mess about with it
foreach my $sidebar (keys %{setting('sidebar_defaults')}) { foreach my $sidebar (keys %{setting('sidebar_defaults')}) {
vars->{'sidebar_defaults'}->{$sidebar} = { map { vars->{'sidebar_defaults'}->{$sidebar} = { map {

View File

@@ -32,7 +32,7 @@ get '/search' => require_login sub {
} }
# pick most likely tab for initial results # pick most likely tab for initial results
if ($q =~ m/^\d+$/) { if ($q =~ m/^[0-9]+$/ and $q < 4096) {
params->{'tab'} = 'vlan'; params->{'tab'} = 'vlan';
} }
else { else {