Skip to content

Commit 208c885

Browse files
danieljurekazure-sdk
authored andcommitted
Add check for empty path to prevent crashes when creating relative paths
1 parent e6903ef commit 208c885

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

eng/common/scripts/Save-Package-Properties.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ function SetOutput($outputPath, $incomingPackageSpec) {
6464
}
6565

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

0 commit comments

Comments
 (0)