Skip to content

Commit 31c4a1b

Browse files
Update original file path value in detect change request to APIView (Azure#39924)
Co-authored-by: Praveen Kuttappan <[email protected]>
1 parent 2772c05 commit 31c4a1b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

eng/common/scripts/Detect-Api-Changes.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,18 @@ function Submit-Request($filePath, $packageName)
4040
$query.Add('language', $LanguageShort)
4141
$query.Add('project', $DevopsProject)
4242
$reviewFileFullName = Join-Path -Path $ArtifactPath $packageName $reviewFileName
43+
# If CI generates token file then it passes both token file name and original file (filePath) to APIView
44+
# If both files are passed then APIView downloads the parent directory as a zip
45+
# 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.
4346
if (Test-Path $reviewFileFullName)
4447
{
4548
$query.Add('codeFile', $reviewFileName)
49+
# Pass only relative path in package artifact directory when code file is also present
50+
$query.Add('filePath', (Split-Path -Leaf $filePath))
51+
}
52+
else
53+
{
54+
$query.Add('filePath', $filePath)
4655
}
4756
$uri = [System.UriBuilder]$APIViewUri
4857
$uri.query = $query.toString()

0 commit comments

Comments
 (0)