fix(ha_adb_common): application-label regex accepts double-quoted labels too (completes the P5-1 parser tolerance)
This commit is contained in:
1 parent
c57a2e2ff2
commit
4661e52041
1 file changed
+5
-2
@@ -9,7 +9,10 @@ tolerant pattern of the androidtv-adb core helper.
|
||||
|
||||
import re
|
||||
|
||||
_APPLICATION_LABEL_RE = re.compile(r"application-label(?:-[A-Za-z_-]+)?:\s*'([^']*)'")
|
||||
_APPLICATION_LABEL_RE = re.compile(
|
||||
r"application-label(?:-[A-Za-z_-]+)?:\s*'([^']*)'"
|
||||
r'|application-label(?:-[A-Za-z_-]+)?:\s*"([^"]*)"'
|
||||
)
|
||||
|
||||
|
||||
def parse_application_label(dump: str) -> str | None:
|
||||
@@ -21,7 +24,7 @@ def parse_application_label(dump: str) -> str | None:
|
||||
if not dump:
|
||||
return None
|
||||
for match in _APPLICATION_LABEL_RE.finditer(dump):
|
||||
label = (match.group(1) or "").strip()
|
||||
label = (match.group(1) or match.group(2) or "").strip()
|
||||
if label and label not in ("null", ""):
|
||||
return label
|
||||
return None
|
||||
Reference in new issue
Block a user