powershell
powershell copied to clipboard
[BUG] Save-PnPSiteTemplate doesn't escape special characters for XML format
Notice
Many bugs reported are actually related to the PnP Framework which is used behind the scenes. Consider carefully where to report an issue:
-
Are you using
Invoke-PnPSiteTemplate
orGet-PnPSiteTemplate
? Yes, I'm using Get-PnPSiteTemplate -
Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Not sure.
-
If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/pnp/powershell/tree/master/src/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/pnp/pnpframework/issues
Reporting an Issue or Missing Feature
XML generated from "Save-PnPSiteTemplate" doesn't escape any special characters that are forbidden in XML format.
Expected behavior
To escape special characters correctly in XML output file.
Actual behavior
When generated an XML output file, here is the example section with special characters
...
<pnp:DataRow>
<pnp:DataValue FieldName="Title">Employee's cat</pnp:DataValue>
<pnp:DataValue FieldName="Order">400</pnp:DataValue>
<pnp:DataValue FieldName="MetaInfo" />
<pnp:DataValue FieldName="FileLeafRef">4_.000</pnp:DataValue>
</pnp:DataRow>
...
Steps to reproduce behavior
- Create a new list and new item with any special characters that should be escaped in XML.
- Run Get-PnPSiteTemplate command
- Run Add-PnPDataRowsToSiteTemplate
- Run Add-PnpFileToSiteTemplate
- Run Save-PnPSiteTemplate
What is the version of the Cmdlet module you are running?
1.8.0
Which operating system/environment are you running PnP PowerShell on?
- [X] Windows
- [ ] Linux
- [ ] MacOS
- [ ] Azure Cloud Shell
- [ ] Azure Functions
- [ ] Other : please specify