Skip to content

Commit

Permalink
Add check for empty path to prevent crashes when creating relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljurek authored and azure-sdk committed Jun 30, 2021
1 parent 7246e32 commit d031d14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eng/common/scripts/Save-Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ function SetOutput($outputPath, $incomingPackageSpec) {
}

function GetRelativePath($path) {
# If the path is empty return an empty string
if (!$path) {
return ''
}
$relativeTo = Resolve-Path $PSScriptRoot/../../../
# Replace "\" with "/" so the path is valid across other platforms and tools
$relativePath = [IO.Path]::GetRelativePath($relativeTo, $path) -replace "\\", '/'
Expand Down

0 comments on commit d031d14

Please sign in to comment.