[error-report-web][PATCH] parser: make contains_tag ignore non-str fields


Yi Fan Yu
 

if `MACHINE` is set to False (in a selftest build),
contains_tags should skip that field instead of
searching for the character '<'.

[YOCTO #14208]

Signed-off-by: Yi Fan Yu <yifan.yu@...>
---
Post/parser.py | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/Post/parser.py b/Post/parser.py
index ed65d4f..f54482a 100644
--- a/Post/parser.py
+++ b/Post/parser.py
@@ -21,10 +21,14 @@ class Parser:

# returns true if the values contain '<' char
# Ignore the failures field (which is an array anyway)
+ # Ignore any non-str fields too [YOCTO #14208]
def contains_tags (self, data):
for key,val in data.items():
if key == 'failures':
continue
+
+ if not isinstance(val, str):
+ continue

if '<' in val:
return True
--
2.25.1

Join yocto@lists.yoctoproject.org to automatically receive all group messages.