(options: T): FileOperator {
content: Buffer.from(templateImpl(decodedContent, {})(options)),
};
} catch (e) {
- if ((e as NodeJS.ErrnoException).code === 'ERR_ENCODING_INVALID_ENCODED_DATA') {
+ if (e instanceof TypeError) {
return entry;
}
diff --git a/packages/schematics/angular/workspace/files/__dot__gitignore.template b/packages/schematics/angular/workspace/files/__dot__gitignore.template
index 0711527ef9d5..cc7b141350ff 100644
--- a/packages/schematics/angular/workspace/files/__dot__gitignore.template
+++ b/packages/schematics/angular/workspace/files/__dot__gitignore.template
@@ -1,4 +1,4 @@
-# See http://help.github.com/ignore-files/ for more about ignoring files.
+# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
# Compiled output
/dist
diff --git a/tests/legacy-cli/e2e/tests/build/prerender/http-requests-assets.ts b/tests/legacy-cli/e2e/tests/build/prerender/http-requests-assets.ts
index 52f7ac439bb1..9d47c5b26194 100644
--- a/tests/legacy-cli/e2e/tests/build/prerender/http-requests-assets.ts
+++ b/tests/legacy-cli/e2e/tests/build/prerender/http-requests-assets.ts
@@ -38,8 +38,11 @@ export default async function () {
],
};
`,
+
// Add asset
'src/assets/media.json': JSON.stringify({ dataFromAssets: true }),
+ 'src/assets/media with-space.json': JSON.stringify({ dataFromAssetsWithSpace: true }),
+
// Update component to do an HTTP call to asset.
'src/app/app.component.ts': `
import { Component, inject } from '@angular/core';
@@ -53,16 +56,23 @@ export default async function () {
imports: [CommonModule, RouterOutlet],
template: \`
{{ data | json }}
+ {{ dataWithSpace | json }}
\`,
})
export class AppComponent {
data: any;
+ dataWithSpace: any;
+
constructor() {
const http = inject(HttpClient);
http.get('/assets/media.json').subscribe((d) => {
this.data = d;
});
+
+ http.get('/assets/media%20with-space.json').subscribe((d) => {
+ this.dataWithSpace = d;
+ });
}
}
`,
@@ -74,4 +84,8 @@ export default async function () {
'dist/test-project/browser/index.html',
/{[\S\s]*"dataFromAssets":[\s\S]*true[\S\s]*}<\/p>/,
);
+ await expectFileToMatch(
+ 'dist/test-project/browser/index.html',
+ /
{[\S\s]*"dataFromAssetsWithSpace":[\s\S]*true[\S\s]*}<\/p>/,
+ );
}