Editing a Markdown file in a public share fails: TextContextProviderFactory::__construct(): Argument #5 ($userId) must be of type string, null given
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- php
- Área
- authentication, backend
Línea de trabajo
Empieza por lib/Provider/TextContextProviderFactory.php y lib/Provider/TextContextProvider.php; después, comprueba cómo gestiona PermissionService un ID de usuario null. Añade una prueba de regresión en tests/unit/Provider/TextContextProviderFactoryTest.php para la construcción de la fábrica con null y verifica que build() y buildForCard() devuelvan contextos válidos. La tarea se considera terminada cuando la edición de recursos compartidos públicos ya no falla con este TypeError y la prueba de regresión pasa.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
After upgrading Nextcloud (35.0.2.2), editing a Markdown file in a public share fails with a 500 error. Deck's TextContextProviderFactory is resolved by the Text app for every registered text context, and on public shares there is no logged-in user, so the DI container injects null into the non-nullable string $userId constructor parameter.
Steps to reproduce
Create a public share link for a Markdown (.md) file
Open the share and start editing the file
The sync request POST /index.php/apps/text/public/session/<id>/sync fails
Error
OCA\Deck\Provider\TextContextProviderFactory::__construct(): Argument #5 ($userId) must be of type string, null given
in /nextcloud/apps/deck/lib/Provider/TextContextProviderFactory.php line 20
Relevant trace: OCA\Text\Controller\PublicSessionController::sync → ApiService::getContext → ContextManager::getContexts → dispatchTyped(RegisterContextEvent) → ServiceEventListener → SimpleContainer::resolve(TextContextProviderFactory::class) → TypeError.
Expected behavior
Editing a Markdown file in a public share works; Deck's context factory must not crash when no user is logged in.
Proposed solution
Widen the constructor parameter to nullable in both classes, since the downstream consumer already accepts null:
lib/Provider/TextContextProviderFactory.php:25: string $userId → ?string $userId
lib/Provider/TextContextProvider.php:34: string $userId → ?string $userId
PermissionService::checkPermission(..., $userId = null) (lib/Service/PermissionService.php:172) and userCan()/userIsBoardOwner() already handle null, so with no user the context simply resolves to read-only instead of throwing a TypeError. A regression test (tests/unit/Provider/TextContextProviderFactoryTest.php) constructs the factory with null userId and asserts build()/buildForCard() still return a valid context.
Environment
Nextcloud 35.0.2.2, Deck current master, Text app public share session
- Lenguaje dominante
- JavaScript
- Estrellas
- 1.4k
- Forks
- 363
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 118
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nextcloud/deck
-
Federated board stacks return 500: getReadMark() called with null user in CardService::enrichCards()Abierto1. to develop bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nextcloud/deck#8721 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
DeckProvider::setSubjects() overwrites IEvent subject with translated sentence → InvalidValueException, Deck bell notifications silently droppedPosiblemente ocupada @tcarrondo la tomó hace 12 días. Abierto0. Needs triage bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
nextcloud/deck#8591 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
CSV export leaves trailing commas in tags and assigned-user fieldsPosiblemente ocupada @Kumar-s75 la tomó hace 62 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
nextcloud/deck#8361 · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de nextcloud/deck
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
home-sweet-gnome/dash-to-panel#2594 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
agentic-community/mcp-gateway-registry#2017 ·
Los mantenedores suelen responder en 1 día
-
P2 Team S Type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google/site-kit-wp#14138 ·
Los mantenedores suelen responder en 2 días
-
from-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
immich-app/immich#33181 ·
Los mantenedores suelen responder en 1 día