Repository navigation
Conversation
Text dispatches RegisterContextEvent on every request, including the public share session sync/save requests. Building the listener for it constructs TextContextProviderFactory, and the container passes null as userId when nobody is logged in, so the string type threw a TypeError and public Markdown previews failed with HTTP 500 while Deck was enabled. Accept a null userId in the factory and the provider, like CardService and PermissionService already do. Fixes nextcloud#8633 Signed-off-by: Muhammad Asad <140322913+Masad791@users.noreply.github.com>
This branch has not been deployed
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
Text dispatches
RegisterContextEventon every request, including thesyncandsaverequests of a public share session. To handle it, the container buildsRegisterTextContextEventListener, which buildsTextContextProviderFactory. On a public share nobody is logged in, so the container passesnullfor$userId. Thestringtype then throws:The request fails with HTTP 500, and the Markdown preview stays on the loading screen. This happens with any Markdown file opened through a public share, not just Deck cards, which is why disabling Deck makes it go away.
This PR makes
$userIdnullable inTextContextProviderFactoryandTextContextProvider, the same wayCardServiceandPermissionServicealready take it. Nothing changes for logged-in users. The provider passes$userIdtoPermissionService::checkPermission(), which treatsnullas the current user. For an anonymous request that still means no permission, so the change doesn't give anonymous users access to cards.The new
TextContextProviderFactoryTestbuilds the factory with anulluser and builds a card context from it. Without the change, the test fails with the same TypeError. I couldn't run the PHPUnit suite here without a Nextcloud server checkout, so the test will first run in CI. The changed files passphp -l.Checklist
🤖 AI (if applicable)