Fix broken build id regex & Return a set from get_filepaths (#110)

* log_analyser: Match application or title when searching for build IDs

* log_analyser: Return a set from get_filepaths
This commit is contained in:
TSRBerry 2024-09-24 20:09:33 +02:00 committed by GitHub
parent fcde1f365c
commit 37651883bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -42,11 +42,11 @@ class LogAnalyser:
)
@staticmethod
def get_filepaths(log_file: str) -> list[str]:
return [
def get_filepaths(log_file: str) -> set[str]:
return set(
x.rstrip("\u0000")
for x in re.findall(r"(?:[A-Za-z]:)?(?:[\\/]+[^\\/:\"\r\n]+)+", log_file)
]
)
@staticmethod
def get_main_ro_section(log_file: str) -> Optional[dict[str, str]]:
@ -88,7 +88,7 @@ class LogAnalyser:
else:
app_id = ""
bids_match_all = re.findall(
r"Build ids found for title ([a-zA-Z0-9]*):[\n\r]*((?:\s+.*[\n\r]+)+)",
r"Build ids found for (?:title|application) ([a-zA-Z0-9]*):[\n\r]*((?:\s+.*[\n\r]+)+)",
log_file,
)
if bids_match_all and len(bids_match_all) > 0:
@ -718,7 +718,7 @@ class LogAnalyser:
"errors": self._log_errors,
"settings": self._settings,
"app_info": self.get_app_info(self._log_text),
"paths": self.get_filepaths(self._log_text),
"paths": list(self.get_filepaths(self._log_text)),
}