404 when device does not exist

This commit is contained in:
Tony Murray
2020-06-15 10:32:07 -05:00
parent 200a39a4b0
commit 1d3664702a

View File

@ -57,12 +57,16 @@ class DeviceController extends Controller
public function index(Request $request, $device_id, $current_tab = 'overview', $vars = '')
{
$device_id = (int)str_replace('device=', '', $device_id);
$current_tab = str_replace('tab=', '', $current_tab);
$current_tab = array_key_exists($current_tab, $this->tabs) ? $current_tab : 'overview';
DeviceCache::setPrimary($device_id);
$device = DeviceCache::getPrimary();
if (!$device->exists) {
abort(404);
}
if ($current_tab == 'port') {
$vars = Url::parseLegacyPath($request->path());
$port = Port::findOrFail($vars->get('port'));