From d8818334884e0287d066ba2c88f859609c707d8f Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Fri, 24 Apr 2020 23:09:15 +0200 Subject: [PATCH] Fix searching for malformated IP or MAC addresses in machine history search --- logs/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/logs/models.py b/logs/models.py index 2641ed24..d139b9da 100644 --- a/logs/models.py +++ b/logs/models.py @@ -27,6 +27,7 @@ from django.contrib.auth.models import Group from django.db.models import Q from django.apps import apps from netaddr import EUI +macaddress.fields import default_dialect from machines.models import IpList from machines.models import Interface @@ -156,12 +157,12 @@ class MachineHistorySearch: pass elif search_type == "mac": try: - search = EUI(search) + search = EUI(search, dialect=default_dialect()) return self._get_by_mac(search)[::-1] except: pass - return None + return [] def _add_revision(self, user, machine, interface): """