this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fallback to the content-type header (#781)

Co-authored-by: Magnus Dahl Eide <magnus@dahleide.com>

authored by

Victor Berchet
Magnus Dahl Eide
and committed by
GitHub
e984e8f2 224a2f05

+14
+5
.changeset/short-knives-camp.md
··· 1 + --- 2 + "@opennextjs/cloudflare": patch 3 + --- 4 + 5 + fallback to the upstream image content-type header
+9
packages/cloudflare/src/cli/templates/images.ts
··· 92 92 contentType = detectContentType(value); 93 93 } 94 94 95 + if (!contentType) { 96 + // Fallback to the sanitized upstream header when the type can not be detected 97 + // https://github.com/vercel/next.js/blob/d76f0b1/packages/next/src/server/image-optimizer.ts#L748 98 + const header = imgResponse.headers.get("content-type") ?? ""; 99 + if (header.startsWith("image/") && !header.includes(",")) { 100 + contentType = header; 101 + } 102 + } 103 + 95 104 if (contentType && !(contentType === SVG && !__IMAGES_ALLOW_SVG__)) { 96 105 const headers = new Headers(imgResponse.headers); 97 106 headers.set("content-type", contentType);