Skip to content

Commit 896052c

Browse files
Fixing download build artifact for accidental repeated download from container (#7715)
1 parent fea9922 commit 896052c

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

Tasks/DownloadBuildArtifactsV0/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@
4242
"loc.messages.ArtifactNameDirectoryNotFound": "Directory '%s' does not exist. Falling back to parent directory: %s",
4343
"loc.messages.LatestBuildFound": "Latest build found: %s",
4444
"loc.messages.LatestBuildNotFound": "Latest build not found",
45-
"loc.messages.LatestBuildFromBranchNotFound": "Latest build from branch %s not found"
45+
"loc.messages.LatestBuildFromBranchNotFound": "Latest build from branch %s not found",
46+
"loc.messages.DownloadingContainerResource": "Downloading items from container resource %s"
4647
}

Tasks/DownloadBuildArtifactsV0/main.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,16 @@ async function main(): Promise<void> {
225225

226226
if (artifact.resource.type.toLowerCase() === "container") {
227227
let downloader = new engine.ArtifactEngine();
228-
var containerParts: string[] = artifact.resource.data.split('/', 3);
229-
if (containerParts.length !== 3) {
228+
229+
console.log(tl.loc("DownloadingContainerResource", artifact.resource.data));
230+
var containerParts = artifact.resource.data.split('/');
231+
232+
if (containerParts.length < 3) {
230233
throw new Error(tl.loc("FileContainerInvalidArtifactData"));
231234
}
232-
233-
var containerId: number = parseInt(containerParts[1]);
234-
var containerPath: string = containerParts[2];
235+
236+
var containerId = parseInt(containerParts[1]);
237+
var containerPath = containerParts.slice(2,containerParts.length).join('/');
235238

236239
var itemsUrl = endpointUrl + "/_apis/resources/Containers/" + containerId + "?itemPath=" + encodeURIComponent(containerPath) + "&isShallow=true&api-version=4.1-preview.4";
237240
console.log(tl.loc("DownloadArtifacts", artifact.name, itemsUrl));

Tasks/DownloadBuildArtifactsV0/task.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"version": {
1010
"Major": 0,
1111
"Minor": 136,
12-
"Patch": 4
12+
"Patch": 5
1313
},
1414
"groups": [
1515
{
@@ -228,6 +228,7 @@
228228
"ArtifactNameDirectoryNotFound": "Directory '%s' does not exist. Falling back to parent directory: %s",
229229
"LatestBuildFound": "Latest build found: %s",
230230
"LatestBuildNotFound":"Latest build not found",
231-
"LatestBuildFromBranchNotFound":"Latest build from branch %s not found"
231+
"LatestBuildFromBranchNotFound":"Latest build from branch %s not found",
232+
"DownloadingContainerResource": "Downloading items from container resource %s"
232233
}
233234
}

Tasks/DownloadBuildArtifactsV0/task.loc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"version": {
1010
"Major": 0,
1111
"Minor": 136,
12-
"Patch": 4
12+
"Patch": 5
1313
},
1414
"groups": [
1515
{
@@ -228,6 +228,7 @@
228228
"ArtifactNameDirectoryNotFound": "ms-resource:loc.messages.ArtifactNameDirectoryNotFound",
229229
"LatestBuildFound": "ms-resource:loc.messages.LatestBuildFound",
230230
"LatestBuildNotFound": "ms-resource:loc.messages.LatestBuildNotFound",
231-
"LatestBuildFromBranchNotFound": "ms-resource:loc.messages.LatestBuildFromBranchNotFound"
231+
"LatestBuildFromBranchNotFound": "ms-resource:loc.messages.LatestBuildFromBranchNotFound",
232+
"DownloadingContainerResource": "ms-resource:loc.messages.DownloadingContainerResource"
232233
}
233234
}

0 commit comments

Comments
 (0)