Skip to content

Commit

Permalink
Fix an error where a lookup that was not REALLY a lookup could be det…
Browse files Browse the repository at this point in the history
…ected. This occurred in a rare instance where a search was looking for using of the literal 'lookup *'
  • Loading branch information
pyth0n1c committed Jan 17, 2025
1 parent 54a0d68 commit 9a29afc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contentctl/objects/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def match_type_to_conf_format(self)->str:
@staticmethod
def get_lookups(text_field: str, director:DirectorOutputDto, ignore_lookups:set[str]=LOOKUPS_TO_IGNORE)->list[Lookup]:
# Comprehensively match all kinds of lookups, including inputlookup and outputlookup
inputLookupsToGet = set(re.findall(r'[^\w]inputlookup(?:\s*(?:(?:append|strict|start|max)\s*=\s*(?:true|t|false|f))){0,4}\s+([^\s\|]+)', text_field, re.IGNORECASE))
outputLookupsToGet = set(re.findall(r'[^\w]outputlookup(?:\s*(?:(?:append|create_empty|override_if_empty|max|key_field|allow_updates|createinapp|create_context|output_format)\s*=\s*[^\s]*))*\s+([^\s\|]+)',text_field,re.IGNORECASE))
lookupsToGet = set(re.findall(r'[^\w](?:(?<!output)(?<!input))lookup(?:\s*(?:(?:local|update)\s*=\s*(?:true|t|false|f))){0,2}\s+([^\s\|]+)', text_field, re.IGNORECASE))
inputLookupsToGet = set(re.findall(r'[^\w]inputlookup(?:\s*(?:(?:append|strict|start|max)\s*=\s*(?:true|t|false|f))){0,4}\s+([\w]+)', text_field, re.IGNORECASE))
outputLookupsToGet = set(re.findall(r'[^\w]outputlookup(?:\s*(?:(?:append|create_empty|override_if_empty|max|key_field|allow_updates|createinapp|create_context|output_format)\s*=\s*[^\s]*))*\s+([\w]+)',text_field,re.IGNORECASE))
lookupsToGet = set(re.findall(r'[^\w](?:(?<!output)(?<!input))lookup(?:\s*(?:(?:local|update)\s*=\s*(?:true|t|false|f))){0,2}\s+([\w]+)', text_field, re.IGNORECASE))


input_lookups = Lookup.mapNamesToSecurityContentObjects(list(inputLookupsToGet-LOOKUPS_TO_IGNORE), director)
Expand Down

0 comments on commit 9a29afc

Please sign in to comment.