Skip to content

Commit

Permalink
Fixed null reference error while getting registry urls (#10782)
Browse files Browse the repository at this point in the history
* Fixed null reference error while getting registry urls

* Fixed EOF for unchanged tasks

* Bumped common task versions
  • Loading branch information
aasim authored Nov 15, 2019
1 parent 648307f commit f0bf16d
Show file tree
Hide file tree
Showing 35 changed files with 52 additions and 49 deletions.
9 changes: 6 additions & 3 deletions Tasks/Common/packaging-common/npm/npmutil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function appendToNpmrc(npmrc: string, data: string): void {
export async function getLocalRegistries(packagingUrls: string[], npmrc: string): Promise<string[]> {
const collectionHosts = packagingUrls.map((pkgUrl: string) => {
const parsedUrl = url.parse(pkgUrl);
if (parsedUrl) {
if (parsedUrl && parsedUrl.host) {
return parsedUrl.host.toLowerCase();
}
return undefined;
Expand All @@ -26,8 +26,11 @@ export async function getLocalRegistries(packagingUrls: string[], npmrc: string)
const registries = NpmrcParser.GetRegistries(npmrc, /* saveNormalizedRegistries */ true);

const localRegistries = registries.filter(registry => {
const registryHost = url.parse(registry).host;
return collectionHosts.indexOf(registryHost.toLowerCase()) >= 0;
const registryUrl = url.parse(registry);
if(registryUrl && registryUrl.host) {
return collectionHosts.indexOf(registryUrl.host.toLowerCase()) >= 0;
}
return undefined;
});

tl.debug(tl.loc('FoundLocalRegistries', localRegistries.length));
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLIV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"demands": [],
"version": {
"Major": 2,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"minimumAgentVersion": "2.115.0",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLIV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"demands": [],
"version": {
"Major": 2,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"minimumAgentVersion": "2.115.0",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DownloadPackageV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "ms-vscs-rm",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"demands": [],
Expand Down
4 changes: 2 additions & 2 deletions Tasks/DownloadPackageV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "ms-vscs-rm",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"demands": [],
Expand Down Expand Up @@ -107,4 +107,4 @@
"OperationFailed": "ms-resource:loc.messages.OperationFailed",
"UnsupportedProjectScopedFeeds": "ms-resource:loc.messages.UnsupportedProjectScopedFeeds"
}
}
}
2 changes: 1 addition & 1 deletion Tasks/DownloadPackageV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"version": {
"Major": 1,
"Minor": 161,
"Patch": 0
"Patch": 1
},
"demands": [],
"releaseNotes": "Adds support to download Maven, Python, Universal and Npm packages.",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/DownloadPackageV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"version": {
"Major": 1,
"Minor": 161,
"Patch": 0
"Patch": 1
},
"demands": [],
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down Expand Up @@ -186,4 +186,4 @@
"Info_Downloading": "ms-resource:loc.messages.Info_Downloading",
"Info_UsingArtifactToolDownload": "ms-resource:loc.messages.Info_UsingArtifactToolDownload"
}
}
}
2 changes: 1 addition & 1 deletion Tasks/MavenV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/MavenV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down Expand Up @@ -409,4 +409,4 @@
"AuthenticationNotNecessary": "ms-resource:loc.messages.AuthenticationNotNecessary",
"UsingAuthFeed": "ms-resource:loc.messages.UsingAuthFeed"
}
}
}
2 changes: 1 addition & 1 deletion Tasks/MavenV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/MavenV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/NpmAuthenticateV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
4 changes: 2 additions & 2 deletions Tasks/NpmAuthenticateV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down Expand Up @@ -66,4 +66,4 @@
"argumentFormat": ""
}
}
}
}
2 changes: 1 addition & 1 deletion Tasks/NpmV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/NpmV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/NuGetCommandV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"version": {
"Major": 2,
"Minor": 161,
"Patch": 0
"Patch": 1
},
"runsOn": [
"Agent",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/NuGetCommandV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"version": {
"Major": 2,
"Minor": 161,
"Patch": 0
"Patch": 1
},
"runsOn": [
"Agent",
Expand Down Expand Up @@ -535,4 +535,4 @@
"Warning_UpdatingNuGetVersion": "ms-resource:loc.messages.Warning_UpdatingNuGetVersion",
"Error_NugetFailedWithCodeAndErr": "ms-resource:loc.messages.Error_NugetFailedWithCodeAndErr"
}
}
}
2 changes: 1 addition & 1 deletion Tasks/NuGetPublisherV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Lawrence Gripper",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/NuGetPublisherV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Lawrence Gripper",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/NuGetToolInstallerV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"preview": false,
Expand Down
4 changes: 2 additions & 2 deletions Tasks/NuGetToolInstallerV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"preview": false,
Expand Down Expand Up @@ -75,4 +75,4 @@
"NGCommon_UnableToFindTool": "ms-resource:loc.messages.NGCommon_UnableToFindTool",
"Warning_UpdatingNuGetVersion": "ms-resource:loc.messages.Warning_UpdatingNuGetVersion"
}
}
}
2 changes: 1 addition & 1 deletion Tasks/NuGetToolInstallerV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"preview": false,
Expand Down
4 changes: 2 additions & 2 deletions Tasks/NuGetToolInstallerV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"preview": false,
Expand Down Expand Up @@ -83,4 +83,4 @@
"NGCommon_UnableToFindTool": "ms-resource:loc.messages.NGCommon_UnableToFindTool",
"Warning_UpdatingNuGetVersion": "ms-resource:loc.messages.Warning_UpdatingNuGetVersion"
}
}
}
2 changes: 1 addition & 1 deletion Tasks/NuGetV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"helpMarkDown": "",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/NuGetV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"helpMarkDown": "ms-resource:loc.helpMarkDown",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PipAuthenticateV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"category": "Package",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
4 changes: 2 additions & 2 deletions Tasks/PipAuthenticateV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"category": "Package",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down Expand Up @@ -86,4 +86,4 @@
"Warn_TooManyFeedEntries": "ms-resource:loc.messages.Warn_TooManyFeedEntries",
"Warning_SessionCreationFailed": "ms-resource:loc.messages.Warning_SessionCreationFailed"
}
}
}
2 changes: 1 addition & 1 deletion Tasks/TwineAuthenticateV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"category": "Package",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
4 changes: 2 additions & 2 deletions Tasks/TwineAuthenticateV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"category": "Package",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down Expand Up @@ -111,4 +111,4 @@
"argumentFormat": ""
}
}
}
}
2 changes: 1 addition & 1 deletion Tasks/UniversalPackagesV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"category": "Package",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/UniversalPackagesV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"category": "Package",
"version": {
"Major": 0,
"Minor": 160,
"Minor": 161,
"Patch": 0
},
"runsOn": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/UseDotNetV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 2,
"Minor": 0,
"Patch": 24
"Patch": 25
},
"satisfies": [
"DotNetCore"
Expand Down
4 changes: 2 additions & 2 deletions Tasks/UseDotNetV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 2,
"Minor": 0,
"Patch": 24
"Patch": 25
},
"satisfies": [
"DotNetCore"
Expand Down Expand Up @@ -181,4 +181,4 @@
"OnlyExplicitVersionAllowed": "ms-resource:loc.messages.OnlyExplicitVersionAllowed",
"SupportPhaseNotPresentInChannel": "ms-resource:loc.messages.SupportPhaseNotPresentInChannel"
}
}
}
4 changes: 2 additions & 2 deletions Tasks/UseNodeV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 160,
"Patch": 1
"Minor": 161,
"Patch": 0
},
"satisfies": [
"Node",
Expand Down
Loading

0 comments on commit f0bf16d

Please sign in to comment.