From 8acdb67346576e2bbac7995390308124ae1c8498 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Fri, 15 May 2020 11:35:12 +0100 Subject: [PATCH] minor bug fixes and cleanup --- lib/App/Netdisco/Util/Web.pm | 2 +- lib/App/Netdisco/Web/Plugin/Search/Node.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/App/Netdisco/Util/Web.pm b/lib/App/Netdisco/Util/Web.pm index 043781a3..638c8ed0 100644 --- a/lib/App/Netdisco/Util/Web.pm +++ b/lib/App/Netdisco/Util/Web.pm @@ -40,7 +40,7 @@ Client has requested JSON format data and an endpoint under C. =cut sub request_is_api { - return ((request->accept =~ m/(?:json|javascript)/) and ( + return ((request->accept and request->accept =~ m/(?:json|javascript)/) and ( index(request->path, uri_for('/api/')->path) == 0 or (param('return_url') diff --git a/lib/App/Netdisco/Web/Plugin/Search/Node.pm b/lib/App/Netdisco/Web/Plugin/Search/Node.pm index 1a34d6b7..3614dc05 100644 --- a/lib/App/Netdisco/Web/Plugin/Search/Node.pm +++ b/lib/App/Netdisco/Web/Plugin/Search/Node.pm @@ -45,7 +45,7 @@ register_search_tab({ description => 'Date Range in format "YYYY-MM-DD to YYYY-MM-DD"', }, age_invert => { - description => 'Date Range is NOT within the supplied range', + description => 'Results should NOT be within daterange', type => 'boolean', default => 'false', }, @@ -241,7 +241,7 @@ ajax '/ajax/content/search/node' => require_login sub { return unless $set and $set->has_rows; $set = $set->search_rs({}, { order_by => 'me.mac' }); - template 'ajax/search/node_by_ip.tt', { + return template 'ajax/search/node_by_ip.tt', { macs => $set, archive_filter => {@active}, };