From c7a35cc1ade2211c5c133cbbb91d048cd9f1acda Mon Sep 17 00:00:00 2001 From: Andrew Querol Date: Thu, 18 Feb 2021 15:15:08 -0600 Subject: [PATCH] Fix device MAC address imports not normalizing. If it is not normalized you can get a not found error when provisioning since that is checking the database with a normalized MAC address --- app/devices/device_imports.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/devices/device_imports.php b/app/devices/device_imports.php index 460c07bf9c..a62ae53862 100644 --- a/app/devices/device_imports.php +++ b/app/devices/device_imports.php @@ -291,6 +291,12 @@ $result[$key] = preg_replace('{\D}', '', $result[$key]); } + //normalize the MAC address + if ($field_name == "device_mac_address") { + $result[$key] = strtolower($result[$key]); + $result[$key] = preg_replace('#[^a-fA-F0-9./]#', '', $result[$key]); + } + //build the data array if (strlen($table_name) > 0) { if (strlen($parent) == 0) {