Skip to content

Commit

Permalink
sdp: fix ci handling in lookup bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
Morg42 committed Feb 1, 2025
1 parent 5158a97 commit e8d7e90
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/model/sdp/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ def _lookup(self, data: str, table: str, rev: bool = False, ci: bool = True) ->
if lu is None:
raise ValueError(f'Lookup table {table} not found.')

orig_data = data
if rev and ci and isinstance(data, str):
data = data.lower()

Expand All @@ -300,8 +301,8 @@ def _lookup(self, data: str, table: str, rev: bool = False, ci: bool = True) ->
lu = self.get_lookup(table)
if not lu:
raise ValueError(f'Lookup table {table} not found.')
if data in lu:
return data
if orig_data in lu:
return orig_data
raise ValueError(f'Lookup of value {data} in table {table} failed, entry not found.')

def _get_cmd_lookup(self, command: str) -> str | None:
Expand Down

0 comments on commit e8d7e90

Please sign in to comment.