Skip to content

Commit

Permalink
Change invalid internal upstream image error code (#39334)
Browse files Browse the repository at this point in the history
fixes #39312
this is more consistent with other errors
an invalid image should cause a validation error and not a server error
  • Loading branch information
madmed88 committed Aug 5, 2022
1 parent b402787 commit 869a2fe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/next/server/image-optimizer.ts
Expand Up @@ -511,7 +511,7 @@ export async function imageOptimizer(
}
} else {
throw new ImageError(
500,
400,
'Unable to optimize image and unable to fallback to upstream image'
)
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/image-optimizer/test/util.js
Expand Up @@ -766,7 +766,7 @@ export function runTests(ctx) {
const query = { url, w: ctx.w, q: 39 }
const opts = { headers: { accept: 'image/webp' } }
const res = await fetchViaHTTP(ctx.appPort, '/_next/image', query, opts)
expect(res.status).toBe(500)
expect(res.status).toBe(400)
expect(await res.text()).toBe(
`Unable to optimize image and unable to fallback to upstream image`
)
Expand Down

0 comments on commit 869a2fe

Please sign in to comment.