From d031d141a5e53d59621bacda2e5b39b155af6737 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Tue, 29 Jun 2021 20:24:03 -0700 Subject: [PATCH] Add check for empty path to prevent crashes when creating relative paths --- eng/common/scripts/Save-Package-Properties.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/common/scripts/Save-Package-Properties.ps1 b/eng/common/scripts/Save-Package-Properties.ps1 index 9e95ad7fc566..7e51813830dd 100644 --- a/eng/common/scripts/Save-Package-Properties.ps1 +++ b/eng/common/scripts/Save-Package-Properties.ps1 @@ -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 "\\", '/'