Skip to content

Commit 06ef41a

Browse files
Fixing the download build artifact issue where if forward slash is me… (#8154)
* Fixing the download build artifact issue where if forward slash is mention for an artifact drop name. If we pass the slash as itemPath the api downloads the first file if the first entry is file instead of returning the metadata about the all the file/folder at root level. However if its folder it works fine. We are reverting back to our old behavior in the task where if just a slash is mentioned for itemPath we pass an empty string.
1 parent 984fb97 commit 06ef41a

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Tasks/DownloadBuildArtifactsV0/main.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ async function main(): Promise<void> {
239239
var containerId = parseInt(containerParts[1]);
240240
var containerPath = containerParts.slice(2,containerParts.length).join('/');
241241

242+
if (containerPath == "/") {
243+
//container REST api oddity. Passing '/' as itemPath downloads the first file instead of returning the meta data about the all the files in the root level.
244+
//This happens only if the first item is a file.
245+
containerPath = ""
246+
}
247+
242248
var itemsUrl = endpointUrl + "/_apis/resources/Containers/" + containerId + "?itemPath=" + encodeURIComponent(containerPath) + "&isShallow=true&api-version=4.1-preview.4";
243249
console.log(tl.loc("DownloadArtifacts", artifact.name, itemsUrl));
244250

Tasks/DownloadBuildArtifactsV0/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"version": {
1010
"Major": 0,
1111
"Minor": 139,
12-
"Patch": 0
12+
"Patch": 1
1313
},
1414
"groups": [
1515
{

Tasks/DownloadBuildArtifactsV0/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"version": {
1010
"Major": 0,
1111
"Minor": 139,
12-
"Patch": 0
12+
"Patch": 1
1313
},
1414
"groups": [
1515
{

0 commit comments

Comments
 (0)