← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:json_decode_fix into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:json_decode_fix into autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/448119
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:json_decode_fix into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/submit.py b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
index 3ab0ca3..5e18f14 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/submit.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
@@ -587,7 +587,10 @@ class Submit:
                     if packages["size"] != 0:
                         for req in packages["requests"]:
                             pkg = req[: req.find("{")].rstrip()
-                            details = json.loads(req[req.find("{") :])
+                            try:
+                                details = json.loads(req[req.find("{") :])
+                            except json.decoder.JSONDecodeError:
+                                return False
                             triggers = details.get("triggers", [])
                             test = {
                                 "release": release,