diff --git a/eng/common/scripts/Detect-Api-Changes.ps1 b/eng/common/scripts/Detect-Api-Changes.ps1 index 831c55ded..6be933321 100644 --- a/eng/common/scripts/Detect-Api-Changes.ps1 +++ b/eng/common/scripts/Detect-Api-Changes.ps1 @@ -40,9 +40,18 @@ function Submit-Request($filePath, $packageName) $query.Add('language', $LanguageShort) $query.Add('project', $DevopsProject) $reviewFileFullName = Join-Path -Path $ArtifactPath $packageName $reviewFileName + # If CI generates token file then it passes both token file name and original file (filePath) to APIView + # If both files are passed then APIView downloads the parent directory as a zip + # If code file is not passed(for e.g. .NET or Java) then APIView needs full path to original file to download only that file. if (Test-Path $reviewFileFullName) { $query.Add('codeFile', $reviewFileName) + # Pass only relative path in package artifact directory when code file is also present + $query.Add('filePath', (Split-Path -Leaf $filePath)) + } + else + { + $query.Add('filePath', $filePath) } $uri = [System.UriBuilder]$APIViewUri $uri.query = $query.toString()