Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: escape <& characters in attribute values #1

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

isuda
Copy link
Contributor

@isuda isuda commented Aug 15, 2024

If you use static initializers in JS you will get an attribute in cobertura's output xml like this:

<method name="<static_initializer>" hits="1" signature="()V">
	<lines >
		<line number="2" hits="1"/>
	</lines>
</method>

This is malformed xml as "<" (or "&") are not allowed in an attribute name according to the spec and a validator will output:

error on line 13 at column 20: Unescaped '<' not allowed in attributes values

Gitlab will not be able to parse the xml and will not display the coverage. I have fixed this by escaping & and < for attributes, as it is in content.

I also changed the ordering as escaping & later in the chain will result in an output like: &amp;lt; instead of &lt;.

@bacebu4
Copy link
Owner

bacebu4 commented Aug 15, 2024

LGTM

@bacebu4 bacebu4 merged commit 9c626aa into bacebu4:master Aug 15, 2024
1 check passed
@bacebu4
Copy link
Owner

bacebu4 commented Aug 15, 2024

Landed in 1.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants