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
@jasonvarga
Copy link
Member

We'll merge the 5.x PR into 6.x

@jasonvarga jasonvarga closed this Jan 30, 2026
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.

AssetsController::show() returns 500 when Asset::find() returns null

2 participants