Skip to content

Commit ba84259

Browse files
authored
fix(assets): check if favicon.ico is a file (#633)
1 parent a6e0210 commit ba84259

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/tender-chicken-deliver.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/aws": patch
3+
---
4+
5+
When copying over assets, check to see if favicon.ico is a file. In some cases favicon.ico is a folder that can contain a route handler.

packages/open-next/src/build/createAssets.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export function createStaticAssets(options: buildHelper.BuildOptions) {
4444

4545
const faviconPath = path.join(appPath, appSrcPath, "favicon.ico");
4646

47-
if (fs.existsSync(faviconPath)) {
47+
// We need to check if the favicon is either a file or directory.
48+
// If it's a directory, we assume it's a route handler and ignore it.
49+
if (fs.existsSync(faviconPath) && fs.lstatSync(faviconPath).isFile()) {
4850
fs.copyFileSync(faviconPath, path.join(outputPath, "favicon.ico"));
4951
}
5052
}

0 commit comments

Comments
 (0)