Skip to content

SPA shell returns 404 on /apps/procest/ (trailing slash); only /apps/procest works #438

Description

@rubenvdlinde

While building the journeydoc capture spec (#437) I discovered the Procest SPA shell does not resolve when the URL has a trailing slash.

Repro

  1. Open http://localhost:8080/apps/procest/ (with trailing slash) — Nextcloud renders "Page not found".
  2. Open http://localhost:8080/apps/procest (no trailing slash) — the dashboard renders correctly.
  3. Same behaviour for /index.php/apps/procest/ vs /index.php/apps/procest.

Root cause

appinfo/routes.php declares two routes named dashboard#page:

['name' => 'dashboard#page', 'url' => '/', 'verb' => 'GET'],
// …
// SPA catch-all — serves the Vue app for any frontend route (history mode).
['name' => 'dashboard#page', 'url' => '/{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], 'defaults' => ['path' => '']],

Nextcloud's route loader keys by name, so only the last entry is registered. occ route:list confirms this — only procest.dashboard.page/apps/procest/{path} is present, the / route is dropped. The catch-all's {path} requirement is .+ so empty path doesn't match either despite the 'defaults' => ['path' => ''] hint, so an exact / returns 404 while <no-slash> falls through to the controller's default $path=''.

Suggested fix

Either:

  • Drop the duplicate / route (the catch-all already handles bare app root once the requirement is loosened to .*), or
  • Keep both routes but rename one (e.g. dashboard#root vs dashboard#page).

Workaround in the capture spec (#437): go() strips trailing slashes before navigation.

Companion finding

While debugging this I also hit a separate (harmless on this URL but real) PHP error: @SuppressWarnings(PHPMD.UnusedFormalParameter) on DashboardController::page() triggers Undefined array key 1 in NC's ControllerMethodReflector (line 41 in lib/private/AppFramework/Utility/ControllerMethodReflector.php), because the annotation isn't in key=value form. Worth either rewriting the annotation as @SuppressWarnings("PHPMD.UnusedFormalParameter") or removing it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions