Skip to content

Conversation

@mynetx
Copy link
Contributor

@mynetx mynetx commented Jan 29, 2026

Summary

  • Add abort_if(! $asset, 404) null guard after Asset::find() in show() and download() methods of AssetsController
  • Prevents 500 errors when an asset cannot be found, returning a proper 404 instead

Test plan

  • Verify requesting a non-existent asset via show() returns 404
  • Verify requesting a non-existent asset via download() returns 404
  • Verify existing asset requests still work normally

Fixes #13739

Add null guard after Asset::find() in show() and download() methods
to return a 404 instead of a 500 error when the asset doesn't exist.

Fixes statamic#13739
@andjsch
Copy link
Contributor

andjsch commented Jan 30, 2026

V5 bug fixes are supported till March 2026. So I'd assume you don't need two separate PRs for v5 and v6. It should be enough to have the v5 one. Changes to v5 should be merged before every v6 release, at least till March or if there's a security issue. https://statamic.dev/knowledge-base/release-schedule-support-policy#support-policy

@jasonvarga jasonvarga merged commit 6e68536 into statamic:5.x Jan 30, 2026
27 checks passed
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.

3 participants