From 21a05d2ea089209b464f1297f22a557ee68eb711 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 2 Feb 2021 09:45:13 +0100 Subject: [PATCH] fix(@angular-devkit/build-angular): error with status code when response code is not 200 During font inlining, a request can return a response status code other than 200. In which case, the contents of the page should not be inlined. --- .../build_angular/src/utils/index-file/inline-fonts.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts.ts b/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts.ts index 1f4275d1b858..7f570ad796c0 100644 --- a/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts.ts +++ b/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts.ts @@ -120,6 +120,12 @@ export class InlineFontsProcessor { }, }, res => { + if (res.statusCode !== 200) { + reject(new Error(`Inlining of fonts failed. ${url} returned status code: ${res.statusCode}.`)); + + return; + } + res .on('data', chunk => rawResponse += chunk) .on('end', () => resolve(rawResponse));