opennextjs / opennextjs-aws

Open-source Next.js adapter for AWS
https://opennext.js.org
MIT License
4.41k stars 131 forks source link

fix(assets): check if favicon.ico is a file #633

Closed chanceaclark closed 1 week ago

chanceaclark commented 1 week ago

What/why?

In the case a Next.js application has a route handler for the favicon.ico path, we need to check to see if it's a file before copying it over to the output directory.

Example:

// /app/favicon.ico/route.ts
export const GET = async () => {
  const favicon = await fetch('https://somecms.com').then((res) => res.arrayBuffer());

  return new Response(favicon, {
    headers: {
      'Content-Type': 'image/x-icon',
    },
  });
};

export const dynamic = 'force-static';
changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: e99dfe80e92ae7f3e2326d1748881aac12b0563b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages | Name | Type | | ---------------- | ----- | | @opennextjs/aws | Patch | | app-pages-router | Patch | | app-router | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

pkg-pr-new[bot] commented 1 week ago

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/aws@633

commit: e99dfe8