diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 876cfb3..b4c3b8f 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -4,10 +4,11 @@
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 17c1b54..6d0cf62 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,4 +4,7 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/webhook-matrix-notifier.iml b/.idea/webhook-matrix-notifier.iml
index a09991b..74d515a 100644
--- a/.idea/webhook-matrix-notifier.iml
+++ b/.idea/webhook-matrix-notifier.iml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/wmn.py b/wmn.py
index 7f7dae3..158943d 100644
--- a/wmn.py
+++ b/wmn.py
@@ -150,22 +150,31 @@ def process_jenkins_request():
f" {shorten(change_message)} {commit_link} by {change['author']} at {htimestamp}",
)
else:
- return shorten(json.dumps(change).replace("<", "&"), appendix="...}")
+ dump = shorten(json.dumps(change), appendix="...}")
+ return (
+ dump,
+ dump.replace("<", "<").replace(">", ">")
+ )
build_name = request.json["displayName"]
project_name = request.json["project"]["fullDisplayName"]
result_type = request.json["result"]["type"]
result_color = request.json["result"]["color"]
- text_change_messages, html_change_messages = zip(*map(extract_change_message, request.json['changes']))
+ changes = request.json['changes']
+ if len(changes) > 0:
+ text_change_messages, html_change_messages = zip(*map(extract_change_message, changes))
+ else:
+ text_change_messages, html_change_messages = (), () # it's an owl!
+
newline = '\n'
try:
room.send_html(f"Build {build_name} on project {project_name} complete: "
f"{result_type}, "
- f"{len(request.json['changes'])} commits
\n"
- "" + (f"\n{newline.join(html_change_messages)}\n
\n" if len(request.json['changes']) > 0 else ""),
+ f"{len(changes)} commits
\n"
+ "" + (f"\n{newline.join(html_change_messages)}\n
\n" if len(html_change_messages) > 0 else ""),
body=f"**Build {build_name} on project {project_name} complete: {result_type}**, "
- f"{len(request.json['changes'])} commits\n"
- "" + (f"{newline.join(text_change_messages)}\n" if len(request.json['changes']) > 0 else ""),
+ f"{len(changes)} commits\n"
+ "" + (f"{newline.join(text_change_messages)}\n" if len(text_change_messages) > 0 else ""),
msgtype=msgtype)
except MatrixRequestError as e:
return matrix_error(e)