mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Ports API: Workaround for ifNames with slashes (#10502)
* Workaround for ifNames with slashes Basically, /api/v0/devices/3/ports/0%2f4 -> /api/v0/devices/3/ports/ifName?ifName=0/4 /api/v0/devices/3/ports/0%2f4/port_bits -> /api/v0/devices/3/ports/ifName/port_bits?ifName=0/4 Or you can just use port_id. * Fix API ports using ifName with slashes hand parse the path for the ports graph endpoints this way we can respect the original way of handling slashes (%2F)
This commit is contained in:
@@ -7,9 +7,7 @@ foreach ($_GET as $name => $value) {
|
||||
$vars[$name] = $value;
|
||||
}
|
||||
|
||||
preg_match('/^(?P<type>[A-Za-z0-9]+)_(?P<subtype>.+)/', $vars['type'], $graphtype);
|
||||
$type = basename($graphtype['type']);
|
||||
$subtype = basename($graphtype['subtype']);
|
||||
list($type, $subtype) = extract_graph_type($vars['type']);
|
||||
|
||||
if (is_numeric($vars['device'])) {
|
||||
$device = device_by_id_cache($vars['device']);
|
||||
|
Reference in New Issue
Block a user