Skip to content

Commit

Permalink
Refactor fix of FilterExpression to prevent incorrect matching
Browse files Browse the repository at this point in the history
  • Loading branch information
ppcad committed Dec 5, 2024
1 parent ec1489d commit f6e7c6f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions logprep/filter/expression/filter_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,11 @@ def _get_value(key: List[str], document: dict) -> Any:

current = document
for item in key:
if not isinstance(current, dict):
raise KeyDoesNotExistError
if item not in current:
raise KeyDoesNotExistError
try:
current = current[item]
except TypeError as error:
raise KeyDoesNotExistError from error
current = current[item]
return current

def __eq__(self, other):
Expand Down

0 comments on commit f6e7c6f

Please sign in to comment.