Merge pull request #11830 from murrant/device-not-found

404 when device does not exist
This commit is contained in:
Tony Murray 2020-06-15 13:03:17 -05:00 committed by GitHub
commit 4e95f667df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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'));