Skip to content

Commit d03b537

Browse files
minijusfilipesilva
authored andcommitted
fix(@schematics/update): update line end normalization for CA file read 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`. (cherry picked from commit 5cdf4cc)
1 parent 3303073 commit d03b537

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/angular/cli/utilities/package-metadata.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function readOptions(
143143
if (typeof value === 'string') {
144144
const cafile = path.resolve(path.dirname(location), value);
145145
try {
146-
options['ca'] = readFileSync(cafile, 'utf8').replace(/\r?\n/, '\\n');
146+
options['ca'] = readFileSync(cafile, 'utf8').replace(/\r?\n/g, '\n');
147147
} catch { }
148148
}
149149
break;

packages/schematics/update/update/npm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function readOptions(
9090
if (typeof value === 'string') {
9191
const cafile = path.resolve(path.dirname(location), value);
9292
try {
93-
options['ca'] = readFileSync(cafile, 'utf8').replace(/\r?\n/, '\\n');
93+
options['ca'] = readFileSync(cafile, 'utf8').replace(/\r?\n/g, '\n');
9494
} catch { }
9595
}
9696
break;

0 commit comments

Comments
 (0)