Skip to content

Commit

Permalink
rpm: fix xml.etree.ElementTree.ParseError issue
Browse files Browse the repository at this point in the history
The license XML tag may contain an ampersand character that should be
escaped, otherwise, it leads to the following error:

    xml.etree.ElementTree.ParseError: not well-formed (invalid token)

As a result, it renders repository unusable. This patch fixes the issue
by escaping the `fmt['license']` value in the `dump_primary` function.

Example:

    <rpm:license>OpenSSL & Chromium CLA</rpm:license>      <-- before
    <rpm:license>OpenSSL &amp; Chromium CLA</rpm:license>  <-- after
  • Loading branch information
Roman Muschinsky authored and ylobankov committed Aug 19, 2022
1 parent a0efdc2 commit c8ca21f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rpmrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def dump_primary(primary):

res += ' <format>\n'

res += ' <rpm:license>%s</rpm:license>\n' % fmt['license']
res += ' <rpm:license>%s</rpm:license>\n' % escape(fmt['license'])

if fmt['vendor']:
res += ' <rpm:vendor>%s</rpm:vendor>\n' % escape(fmt['vendor'])
Expand Down

0 comments on commit c8ca21f

Please sign in to comment.