Skip to content

Deleting the last subpage does not convert the parent back from {Titel}/Readme.md to {Titel}.md — orphaned folder page renders broken #2696

Description

@tilllt

Describe the bug

About this report: This analysis was produced automatically by Hermes (an autonomous AI agent) during a systematic debugging session against a live Nextcloud instance. All reproduction steps were executed against the real API/WebDAV; versions are from the instance's own status endpoints.

When the last subpage of a page is deleted, the parent page is not converted back from its subfolder form ({Titel}/Readme.md) to a regular page file ({Titel}.md). The page stays as a folder with a Readme.md but no remaining subpages. Such an "orphaned folder page" is then not rendered correctly in the Collectives UI: the page's content is not shown as a normal page — the user sees raw/HTML garbage below the rendered footer (or the page appears broken / not visible as a page at all).

Additionally, the parent's subpageOrder still references the deleted child's page ID (a stale ID — related to #2588, but the folder-conversion aspect is not covered there).

To Reproduce

Steps to reproduce the behavior (via the Collectives REST API v1.0 + WebDAV):

  1. Create a page P (parent page), e.g. POST /collectives/1/pages with title P.
    • The page is stored as a regular file: P.md (WebDAV: .../.Kollektive/<collective>/P.md), API reports fileName: "P.md".
  2. Create a subpage C of P (parentId = P's ID).
    • Collectives auto-converts P to a folder: WebDAV now shows P/Readme.md, API reports fileName: "Readme.md", filePath: "P", subpageOrder: [C-id].
  3. Delete C (move to trash) and permanently purge it.
    • Expected: P converts back to a regular file P.md.
    • Actual: P remains a folder P/Readme.md with an empty subpageOrder — the reverse conversion never happens.
  4. Open page P in the Collectives UI.
    • Expected: page content rendered as a normal page.
    • Actual: the page is not rendered as a regular page — the raw Markdown/HTML content shows up as broken "HTML garbage" below the footer; the page appears broken or is not shown in the page list at all.

Expected behavior

  • When the last subpage is deleted, the parent should be converted back from {Titel}/Readme.md (folder form) to {Titel}.md (regular page file), mirroring the automatic Page.md → Page/Readme.md conversion that happens when the first subpage is created.
  • The parent's subpageOrder should be cleaned up when a child page is deleted (see Subpage ID not deleted when page is deleted #2588).
  • An "orphaned folder page" (folder + Readme.md, zero subpages) should never be presented to the UI in a broken state.

Screenshots

The broken rendering: a page stored as My-Page/Readme.md (folder, no subpages) showed its content partially rendered, followed by a block of raw HTML/XML below the footer instead of the Markdown being rendered as a normal page. After manually restoring the file to My-Page.md via WebDAV MOVE, the page rendered correctly.

Server details:

  • Collectives app version: 4.4.1
  • Nextcloud version: 33.0.5
  • PHP Version: managed (AIO-like environment)
  • Database: managed

Client details:

  • OS: any (server-side rendering issue)
  • Browser: any
Logs

No server exceptions were observed in the Nextcloud log during reproduction. The issue is purely about page storage layout + UI rendering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions