Skip to content

fix: release the Text file lock when leaving the editor with the back button - #4342

Open
Flamenco wants to merge 1 commit into
nextcloud:masterfrom
Flamenco:fix/text-back-releases-lock
Open

Flamenco wants to merge 1 commit into
nextcloud:masterfrom
Flamenco:fix/text-back-releases-lock

Conversation

@Flamenco

Copy link
Copy Markdown

Opening a Markdown file in the app and leaving it with the back button leaves the file permanently "Locked by Text" on the server. Leaving with Text's own close (✕) button does not.

The close button runs Text's close(): it saves, closes the editing session (which releases the files_lock lock), then posts close to DirectEditingMobileInterface. The back button pops NCViewerDirectEditing without any of that. viewWillDisappear already calls onClose() for Collabora, but there was no equivalent for Text.

For the Text editor, this PR replaces the back button with one that presses Text's close button and lets the existing close message pop the view. If the editor has not loaded, there is nothing to close and it leaves at once; a 5 s fallback avoids ever blocking navigation. Other editors are unchanged.

Verification: the cause was verified on iPadOS 26.6 with Text 8.0.0 on Nextcloud 34.0.3. Leaving with ✕ removed the row from oc_files_lock; leaving with the back button left it there indefinitely. The change itself has not been run on a device yet; it is built and tested by CI here.

Fixes nextcloud/text#8858

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (Claude Code located the cause and wrote the change; the Assisted-by trailer is on the commit)

… button

Leaving a Markdown file with the back button popped NCViewerDirectEditing
without running Text's close(), so the editing session was never closed and
the file stayed "Locked by Text" on the server. Text's own close button saves,
closes the session (releasing the lock) and then posts "close".

For the Text editor, route the back button through that close button and let
the existing "close" message pop the view, with a 5 s fallback so navigation
can never get stuck.

Fixes nextcloud/text#8858

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Steven Spungin <steven@spungin.tv>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persistent "Locked by Text" file lock after opening Markdown file in iOS app (MOVE fails with Sabre\DAV\Exception\Locked)

1 participant