File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/PSAppDeployToolkit.Tools/Public Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -263,20 +263,20 @@ function Convert-ADTDeployment
263263 $hashtableContent = $hashtableAst.Right.Extent.Text
264264
265265 # Update the appScriptDate value to the current date
266- $hashtableContent = $hashtableContent -replace " appScriptDate\s*=\s*'[^']+'" , " appScriptDate = '$ ( Get-Date - Format " yyyy-MM-dd" ) '"
266+ $hashtableContent = $hashtableContent -replace " (?m)(^\s* appScriptDate\s*=) \s*'[^']+'" , " `$ 1 '$ ( Get-Date - Format " yyyy-MM-dd" ) '"
267267
268268 # Copy each variable value from the input script to the hashtable
269269 foreach ($variableReplacement in $variableReplacements )
270270 {
271271 $assignmentAst = $inputScriptAst.Find ({
272272 param ($ast )
273- $ast -is [System.Management.Automation.Language.AssignmentStatementAst ] -and $ast.Left.Extent.Text -match " ^\[[^\]]+\]?\`$ $variableReplacement $"
273+ $ast -is [System.Management.Automation.Language.AssignmentStatementAst ] -and $ast.Left.Extent.Text -match " ^( \[[^\]]+\]) ?\`$ (adtSession\.)? $variableReplacement $"
274274 }, $true )
275275
276276 if ($assignmentAst )
277277 {
278278 $variableValue = $assignmentAst.Right.Extent.Text
279- $hashtableContent = $hashtableContent -replace " $variableReplacement \s*=\s*'[^']*'" , " $variableReplacement = $variableValue "
279+ $hashtableContent = $hashtableContent -replace " (?m)(^\s* $variableReplacement \s*=) \s*'[^']*'" , " `$ 1 $variableValue "
280280 }
281281 }
282282
You can’t perform that action at this time.
0 commit comments