Skip to content

Commit d6e666d

Browse files
authored
Merge pull request #1083 from yuancjun/patch-1
Update safe_xmlstr filtering logic to include whitespace filtering
2 parents f0cc2fd + d2abd94 commit d6e666d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

uiautomator2/xpath.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class XPathError(Exception):
3434

3535

3636
def safe_xmlstr(s: str) -> str:
37+
# https://www.w3.org/TR/xml/#NT-NameStartChar
38+
s = s.strip()
3739
s = re.sub('[$@#&]', '.', s)
3840
s = re.sub('\\.+', '.', s)
3941
s = re.sub('^\\.|\\.$', '', s)

0 commit comments

Comments
 (0)