From bc2328a239f069593d8d85f1cbfe97518d91e36d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Sun, 14 Aug 2022 21:52:24 +0200 Subject: [PATCH] fixing up sqlite --- server/src/uds/REST/methods/actor_v3.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/src/uds/REST/methods/actor_v3.py b/server/src/uds/REST/methods/actor_v3.py index 59f5fe4b..1c9fdeb5 100644 --- a/server/src/uds/REST/methods/actor_v3.py +++ b/server/src/uds/REST/methods/actor_v3.py @@ -66,7 +66,8 @@ class BlockAccess(Exception): # Helpers - +def fixIdsList(idsList: typing.List[str]) -> typing.List[str]: + return [i.upper() for i in idsList] + [i.lower() for i in idsList] def checkBlockedIp(ip: str) -> None: if GlobalConfig.BLOCK_ACTOR_FAILURES.getBool() is False: @@ -263,8 +264,8 @@ class Initialize(ActorV3Action): # Valid actor token, now validate access allowed. That is, look for a valid mac from the ones provided. try: - # Enforce lowecase ids for sqlite - idsList = [i.lower() for i in idsList] + # ensure idsLists has upper and lower versions for case sensitive databases + idsList = fixIdsList(idsList) # Set full filter dbFilter = dbFilter.filter( unique_id__in=idsList, @@ -433,8 +434,8 @@ class LoginLogout(ActorV3Action): x['mac'] for x in self._params['id'] ][:10] - # Enforce lowercase for idList - idsList = [x.lower() for x in idsList] + # ensure idsLists has upper and lower versions for case sensitive databases + idsList = fixIdsList(idsList) validId: typing.Optional[str] = service.getValidId(idsList) @@ -647,8 +648,8 @@ class Unmanaged(ActorV3Action): ][:10] validId: typing.Optional[str] = service.getValidId(idsList) - # enforce lowercase idsList - idsList = [i.lower() for i in idsList] + # ensure idsLists has upper and lower versions for case sensitive databases + idsList = fixIdsList(idsList) # Check if there is already an assigned user service # To notify it logout