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>
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
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)