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

(#27) Escape PackageProperties elements #28

Merged
merged 1 commit into from
Oct 14, 2021

Conversation

TheCakeIsNaOH
Copy link
Member

@TheCakeIsNaOH TheCakeIsNaOH commented Oct 1, 2021

On .Net fx, the PackageProperties elements have xml special chars
escaped. On Mono, they do not get escaped. mono/mono#21227

In the process of reading the nuspec metadata, escaped chars like "<"
get converted back into what they represent, for example "<". This is
not an issue on Windows, but is it an issue on Mono.

This manually escapes xml special chars from the PackageProperties
strings. The id and version are not escaped, as they cannot contain xml
special chars in the first place.

Fixes #27

How this PR was tested:

  1. Clone this repository on both a windows system and a linux system: https://github.com/Starz0r/ChocolateyPackagingScripts/tree/master/src/templates/dust
  2. Build the dust package on both to validate that it will build on windows and fail on linux
  3. Build and strongname nuget-chocolatey
  4. Drop the dll and pdb into the choco source code tree on windows and build choco
  5. Pack the dust package on windows with the artifact from the previous step to validate that it still works.
  6. Drop the dll and pdb into the choco source code tree on linux and build choco
  7. Pack the dust package on linux with the artifact from the previous step to validate that this pr fixes the issue on Linux
  8. Add a &lt; to each of the title, authors, and tags elements in the dust.nuspec on the Linux system
  9. Run the pack again to validate that the escaping of the other elements works.

On .Net fx, the PackageProperties elements have xml special chars
escaped. On Mono, they do not get escaped. mono/mono#21227

In the process of reading the nuspec metadata, escaped chars like "&lt;"
get converted back into what they represent, for example "<". This is
not an issue on Windows, but is it an issue on Mono.

This manually escapes xml special chars from the PackageProperties
strings. The id and version are not escaped, as they cannot contain xml
special chars in the first place.
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gep13 gep13 merged commit a4bdeb1 into chocolatey:2.11_adds Oct 14, 2021
@gep13
Copy link
Member

gep13 commented Oct 14, 2021

@TheCakeIsNaOH thanks for getting this updated. Will get this pulled through into chocolatey/choco.

@TheCakeIsNaOH TheCakeIsNaOH deleted the xml-escape branch October 15, 2021 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Building a package on Linux fails if the description has encoded xml special character(s)
2 participants