Skip to content

[2.x] fix: gracefully handle unavailable/unconfigured adapters when rendering posts#483

Merged
imorland merged 1 commit into
2.xfrom
im/fix-unavailable-adapter-crash
Apr 9, 2026
Merged

[2.x] fix: gracefully handle unavailable/unconfigured adapters when rendering posts#483
imorland merged 1 commit into
2.xfrom
im/fix-unavailable-adapter-crash

Conversation

@imorland

@imorland imorland commented Apr 9, 2026

Copy link
Copy Markdown
Member

Summary

  • When a file was uploaded via an adapter that is now removed or unconfigured (e.g. Imgur with no client ID), Manager::instantiate() would call the factory method, get null back, then crash with a TypeError from property_exists(null, ...) — breaking the entire forum index/discussion view
  • getUrlForFile() and getThumbnailUrlForFile() now catch ValidationException from instantiate() and return null, so posts degrade gracefully (falling back to the stored URL for imgur files)
  • cleanUp() skips files whose adapter cannot be instantiated rather than aborting
  • Adds the missing down key to the 2026_02_21 migration, which caused a MigrationKeyMissing error when running migrate:reset

…ng posts

When a file was uploaded via an adapter that is now removed or
unconfigured (e.g. Imgur with no client ID set), rendering a post
containing that upload would crash with a TypeError from
property_exists() being passed null.

- Manager::instantiate() now throws ValidationException if the factory
  method returns null (e.g. imgur() with no client ID configured)
- FileRepository::getUrlForFile() and getThumbnailUrlForFile() catch
  ValidationException and return null, so post rendering degrades
  gracefully instead of throwing
- FileRepository::cleanUp() skips files whose adapter cannot be
  instantiated rather than aborting mid-run
- Add missing 'down' key to 2026_02_21 migration to fix
  MigrationKeyMissing error when running migrate:reset
@imorland imorland requested a review from a team as a code owner April 9, 2026 19:27
@imorland imorland changed the title fix: gracefully handle unavailable/unconfigured adapters when rendering posts [2.x] fix: gracefully handle unavailable/unconfigured adapters when rendering posts Apr 9, 2026
@imorland imorland merged commit 5d2dad7 into 2.x Apr 9, 2026
20 checks passed
@imorland imorland deleted the im/fix-unavailable-adapter-crash branch April 9, 2026 19:29
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.

1 participant