mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 02:18:39 +00:00
return api error when device doesn't exist (#12978)
* return api error when device doesn't exist Function device_by_id_cache returns a hash table, which isn't null despite the device not existing. This checks to see if the type has been populated to also determine if the device exists. Without this, the function always returns a "valid" device, even if one doesn't exist. * use device_id instead of type
This commit is contained in:
parent
03aa453893
commit
b6f9dd29df
@ -266,7 +266,7 @@ function get_device(Illuminate\Http\Request $request)
|
||||
|
||||
// find device matching the id
|
||||
$device = device_by_id_cache($device_id);
|
||||
if (! $device) {
|
||||
if (! $device || ! $device['device_id']) {
|
||||
return api_error(404, "Device $hostname does not exist");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user