From b758793987c244779cc45a20f5d16cdc828fba68 Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Sat, 4 Feb 2023 08:59:44 +0100 Subject: [PATCH] Fix updateinfo date format and enable short tags --- apollo/server/routes/api_updateinfo.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/apollo/server/routes/api_updateinfo.py b/apollo/server/routes/api_updateinfo.py index b4b6c2c..9e6ead2 100644 --- a/apollo/server/routes/api_updateinfo.py +++ b/apollo/server/routes/api_updateinfo.py @@ -95,10 +95,10 @@ async def get_updateinfo( # Add time time_format = "%Y-%m-%d %H:%M:%S" - ET.SubElement(update, "issued" - ).text = advisory.published_at.strftime(time_format) - ET.SubElement(update, "updated" - ).text = advisory.updated_at.strftime(time_format) + issued = ET.SubElement(update, "issued") + issued.set("date", advisory.published_at.strftime(time_format)) + updated = ET.SubElement(update, "updated") + updated.set("date", advisory.updated_at.strftime(time_format)) # Add rights now = datetime.datetime.utcnow() @@ -313,6 +313,11 @@ async def get_updateinfo( tree.remove(update) ET.indent(tree) - xml_str = ET.tostring(tree, encoding="unicode", method="xml") + xml_str = ET.tostring( + tree, + encoding="unicode", + method="xml", + short_empty_elements=True, + ) return Response(content=xml_str, media_type="application/xml")