refactor(preview): align provider lookup in PreviewManager checks#61629
Open
joshtrichards wants to merge 1 commit into
Open
refactor(preview): align provider lookup in PreviewManager checks#61629joshtrichards wants to merge 1 commit into
joshtrichards wants to merge 1 commit into
Conversation
…y checks Signed-off-by: Josh <josh.t.richards@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This refactor makes preview provider support and availability checks follow the same provider-loading path as preview generation instead of reading partially initialized provider state directly.
Why
getProviders()registers core and bootstrap providers and applies provider ordering. Preview generation already resolves providers throughgetProviders(), butisMimeSupported()andisAvailable()currently inspect$this->providersdirectly after partial setup.This means support and availability checks do not use the same provider-loading and ordering path as preview generation, and
isAvailable()also currently relies onisMimeSupported()side effects to register bootstrap providers before iterating providers.This PR:
PreviewManager::getProviders()as the shared provider-loading pathisMimeSupported()to inspect the provider set returned bygetProviders()isAvailable()to iterate providers viagetProviders()isMimeSupported()andisAvailable()This does not change provider registration rules, MIME regexes, or preview generation logic.
In edge cases, this should also reduce the risk of preview capability checks disagreeing with the provider set ultimately used for generation.
It also prepares the code for follow-up refactors (e.g. further centralization of provider matching / traversal logic shared between
PreviewManagerandGenerator).Checklist
3. to review, feature component)stable32)AI (if applicable)