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 quotes in inner dsc block #36

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ReverseDSC.Core.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -715,10 +715,15 @@ we should not have commas in between items it contains.
When the parameter is a CIM array, it may contain parameter with double quotes
We need to ensure that endPosition does not correspond to such parameter
by checking if the second character before " is =
Additionally, there might be other values in the DSC block, e.g. from xml,
which contain other properties like <?xml version="1.0"?>, where we do
not want to remove the quotes as well.
#>
if ($IsCIMArray)
{
while ($endPosition -gt 1 -and $DSCBlock.substring($endPosition -2,3) -eq "= `"")
while ($endPosition -gt 1 -and `
($DSCBlock.substring($endPosition -2,3) -eq "= `"" -or `
$DSCBlock.substring($endPosition -1,2) -eq "=`""))
{
#This retrieve the endquote that we skip
$endPosition = $DSCBlock.IndexOf("`"", $endPosition + 1)
Expand Down Expand Up @@ -789,10 +794,15 @@ we should not have commas in between items it contains.
When the parameter is a CIM array, it may contain parameter with double quotes
We need to ensure that startPosition does not correspond to such parameter
by checking if the second character before " is =
Additionally, there might be other values in the DSC block, e.g. from xml,
which contain other properties like <?xml version="1.0"?>, where we do
not want to remove the quotes as well.
#>
if ($IsCIMArray)
{
while ($startPosition -gt 1 -and $DSCBlock.Substring($startPosition -2,3) -eq "= `"")
while ($startPosition -gt 1 -and `
($DSCBlock.Substring($startPosition -2,3) -eq "= `"" -or `
$DSCBlock.Substring($startPosition -1,2) -eq "=`""))
{
#This retrieve the endquote that we skip
$startPosition = $DSCBlock.IndexOf("`"", $startPosition + 1)
Expand Down