Skip to content

Commit

Permalink
Escape the backslashes before using in replace
Browse files Browse the repository at this point in the history
  • Loading branch information
mariru27 committed Feb 4, 2025
1 parent adf1f34 commit b21024e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,9 @@ Function Convert-UnixPathToDos([Parameter(Mandatory = $true)][string] $content)
{
continue
}

$content = $content -replace $path,($path -replace '/','\')
# Escape the backslashes in before using it in -replace.
$escapedPath = [regex]::Escape($path)
$content = $content -replace $escapedPath, ($path -replace '/','\')
}
return $content
}
Expand Down

0 comments on commit b21024e

Please sign in to comment.