Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Fixed missing source + resized images producing rendered 404 #19869

Merged
merged 2 commits into from Mar 18, 2024

Conversation

daniellockyer
Copy link
Member

fixes https://linear.app/tryghost/issue/ENG-746/http-500-responses-when-handle-image-sizes-middleware-hits-missing

  • in the event a request comes in for a resized image, but the source image does not exist, we return a rendered 404 page
  • we do this because we pass the NotFoundError to next, which skips over the static asset code where we return a plaintext 404
  • also included a breaking test that ensure we go to the next middleware without an error

fixes https://linear.app/tryghost/issue/ENG-746/http-500-responses-when-handle-image-sizes-middleware-hits-missing

- in the event a request comes in for a resized image, but the source
  image does not exist, we return a rendered 404 page
- we do this because we pass the NotFoundError to `next`, which skips
  over the static asset code where we return a plaintext 404
- also included a breaking test that ensure we go to the next middleware
  without an error
Copy link
Contributor

@allouis allouis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an e2e test would be really valuable for this - that will catch any cases where the error thrown for a missing file changes and doesn't have the expected errorType

@daniellockyer
Copy link
Member Author

@allouis How about 0bed06d?

@daniellockyer daniellockyer marked this pull request as ready for review March 18, 2024 17:14
@allouis allouis self-requested a review March 18, 2024 17:20
@daniellockyer daniellockyer merged commit 134c33c into main Mar 18, 2024
20 checks passed
@daniellockyer daniellockyer deleted the image-500 branch March 18, 2024 17:32
royalfig pushed a commit that referenced this pull request Mar 25, 2024
fixes https://linear.app/tryghost/issue/ENG-746/http-500-responses-when-handle-image-sizes-middleware-hits-missing

- in the event a request comes in for a resized image, but the source
image does not exist, we return a rendered 404 page
- we do this because we pass the NotFoundError to `next`, which skips
over the static asset code where we return a plaintext 404
- also included a breaking test that ensure we go to the next middleware
without an error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants