Skip to content

Commit

Permalink
fix(@schematics/update): update line end normalization for CA file re…
Browse files Browse the repository at this point in the history
…ad from .npmrc

Before only first line end was being replaced.
Also, the replace value was incorrectly escaped.

The CA read from cafile being corrupt resulted in broken updates
when using registry with self-signed certificate.

The workaround till this is merged is to use `ca` or `ca[]` properties in `.npmrc`.
  • Loading branch information
minijus authored and filipesilva committed Jan 26, 2021
1 parent 2f050fd commit 5cdf4cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/angular/cli/utilities/package-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function readOptions(
if (typeof value === 'string') {
const cafile = path.resolve(path.dirname(location), value);
try {
options['ca'] = readFileSync(cafile, 'utf8').replace(/\r?\n/, '\\n');
options['ca'] = readFileSync(cafile, 'utf8').replace(/\r?\n/g, '\n');
} catch { }
}
break;
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/update/update/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function readOptions(
if (typeof value === 'string') {
const cafile = path.resolve(path.dirname(location), value);
try {
options['ca'] = readFileSync(cafile, 'utf8').replace(/\r?\n/, '\\n');
options['ca'] = readFileSync(cafile, 'utf8').replace(/\r?\n/g, '\n');
} catch { }
}
break;
Expand Down

0 comments on commit 5cdf4cc

Please sign in to comment.