@opennextjs/cloudflare 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,6 +64,14 @@ export async function fetchImage(fetcher, imageUrl, ctx) {
64
64
  if (value) {
65
65
  contentType = detectContentType(value);
66
66
  }
67
+ if (!contentType) {
68
+ // Fallback to the sanitized upstream header when the type can not be detected
69
+ // https://github.com/vercel/next.js/blob/d76f0b1/packages/next/src/server/image-optimizer.ts#L748
70
+ const header = imgResponse.headers.get("content-type") ?? "";
71
+ if (header.startsWith("image/") && !header.includes(",")) {
72
+ contentType = header;
73
+ }
74
+ }
67
75
  if (contentType && !(contentType === SVG && !__IMAGES_ALLOW_SVG__)) {
68
76
  const headers = new Headers(imgResponse.headers);
69
77
  headers.set("content-type", contentType);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opennextjs/cloudflare",
3
3
  "description": "Cloudflare builder for next apps",
4
- "version": "1.5.0",
4
+ "version": "1.5.1",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "opennextjs-cloudflare": "dist/cli/index.js"
@@ -44,6 +44,7 @@
44
44
  "dependencies": {
45
45
  "@dotenvx/dotenvx": "1.31.0",
46
46
  "@opennextjs/aws": "3.7.0",
47
+ "cloudflare": "^4.4.1",
47
48
  "enquirer": "^2.4.1",
48
49
  "glob": "^11.0.0",
49
50
  "ts-tqdm": "^0.8.6"
@@ -55,7 +56,6 @@
55
56
  "@types/mock-fs": "^4.13.4",
56
57
  "@types/node": "^22.2.0",
57
58
  "@types/picomatch": "^4.0.0",
58
- "cloudflare": "^4.4.1",
59
59
  "diff": "^8.0.2",
60
60
  "esbuild": "^0.25.4",
61
61
  "eslint": "^9.11.1",