ui/script registered with type=files is never loaded on the Files page

Abierto
#1,193 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php
Área
api, backend

Línea de trabajo

Read lib/Listener/LoadFilesPluginListener.php and lib/Controller/TopMenuController.php, then trace how ScriptsService::applyExAppScripts() is called for top-menu pages. Find the Files-page script loading entry point and determine how it can apply registered files scripts and styles. Done when a Files script registered through POST /api/v1/ui/script is injected on /apps/files/ and the existing top-menu behavior still works.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

What happens

POST /api/v1/ui/script accepts type=files and stores the entry (oc_ex_ui_scripts gets the row), but the script is never loaded on the Files page.

ScriptsService::applyExAppScripts() — the only thing that turns a registered script into a <script> tag — has exactly one caller:

lib/Controller/TopMenuController.php:72
    $this->jsProxyMap = $this->scriptsService->applyExAppScripts($appId, 'top_menu', $menuEntry->getName());

So only ExApp top-menu pages get their scripts injected. LoadFilesPluginListener (the Files-page listener) only publishes ex_files_actions_menu and loads AppAPI's own app_api-filesplugin.js; it never calls applyExAppScripts.

Why it matters

An ExApp that registers a Files action via ui/files-actions-menu has no supported way to show progress or a result for it. The action is executed by AppAPI's plugin, which returns true/false and (optionally) honours redirect_handler, so a long-running action can only report success/failure — no progress, no link to its output. The natural approach (ui/script with type=files) silently does nothing.

Concretely: an OCR ExApp enqueues a job and returns 202. The user sees nothing until they refresh the folder, and there is no way to tell a queued job from a failed one.

Reproduction
  1. ExApp registers a script: POST /api/v1/ui/script {"type": "files", "name": "files_action", "path": "js/foo"}
  2. oc_ex_ui_scripts contains appid | files | files_action | js/foo
  3. Load /apps/files/ → no <script> for proxy_js/* and no request to /apps/app_api/proxy/<appid>/js/foo.js

The same registration with type: top_menu works, because TopMenuController applies it.

Expected

ui/script (and ui/style) registered for type=files should be injected into the Files page, the same way top_menu entries are injected into their pages — e.g. a LoadAdditionalScriptsEvent listener that calls applyExAppScripts($appId, 'files', '').

Environment
  • Nextcloud 34.0.5.1
  • app_api 34.0.0 (checked against main — lib/Listener/ is unchanged there)
  • Deploy daemon: HaRP on a rootless podman socket (the script itself is served fine through the proxy: GET /index.php/apps/app_api/proxy/<appid>/js/files_action.js → 200 text/javascript; it is simply never referenced)
Lenguaje dominante
PHP
Estrellas
202
Forks
30
Merge medio
3 d 20 h
PR fusionados (30 d)
24

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de nextcloud/app_api

Todos los issues de nextcloud/app_api

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.