diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm index 4aa26527..dafb43df 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm @@ -31,9 +31,19 @@ ajax '/ajax/content/device/ports' => require_login sub { return unless $set->count; } else { - $f =~ s/\*/%/g if index($f, '*') >= 0; - $f =~ s/\?/_/g if index($f, '?') >= 0; - $f = { '-ilike' => $f }; + # Google-style search. Quoted means exact, otherwise wildcard. + # but still supoort manual wildcarding. + if ($f =~ m/^['"]/ and $f =~ m/['"]$/) { + $f =~ s/^['"]//; + $f =~ s/['"]$//; + } + else { + $f =~ s/\*/%/g; + $f =~ s/\?/_/g; + $f =~ s/^\%*/%/; + $f =~ s/\%*$/%/; + $f = { '-ilike' => $f }; + } if ($set->search({'me.port' => $f})->count) { $set = $set->search({'me.port' => $f}); diff --git a/Netdisco/share/views/ajax/device/addresses.tt b/Netdisco/share/views/ajax/device/addresses.tt index 36231a3c..d4d45cd5 100644 --- a/Netdisco/share/views/ajax/device/addresses.tt +++ b/Netdisco/share/views/ajax/device/addresses.tt @@ -14,7 +14,7 @@