← Back to team overview

canonical-ubuntu-qa team mailing list archive

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

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:web_request_amend_invalid_function 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/447116
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:web_request_amend_invalid_function into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/app.py b/charms/focal/autopkgtest-web/webcontrol/request/app.py
index 8654ec2..fa94f33 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/app.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/app.py
@@ -90,9 +90,15 @@ def invalid(message, code=400):
         html = LOGOUT.format(**session)
     else:
         html = ""
-    html += "<p>You submitted an invalid request: %s</p>" % maybe_escape(
-        str(message)
-    )
+    if "\n" not in message:
+        html += "<p>You submitted an invalid request: %s</p>" % maybe_escape(
+            str(message)
+        )
+    else:
+        html += "<p>You submitted an invalid request: </p>"
+        list_of_messages = message.split("\n")
+        for msg in list_of_messages:
+            html += "<p>" + str(msg) + "</p>"
     logging.error("Request failed with %i: %s", code, message)
     return HTML.format(html), code