nextcloud / nextcloud/android

Collaborative file lock not released when closing editor WebView

Open
#17,380 2 comments 2 reactions 0 assignees View on GitHub
0. Needs triage bug
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### ⚠️ Before posting ⚠️

- [x] This is a **bug**, not a question or an enhancement.
- [x] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).

### Steps to reproduce

When opening an editable file (markdown, rich document) via the in-app WebView editor (`TextEditorWebView` / `RichDocumentsEditorWebView`), the server's editor app (Nextcloud Text, Collabora) sets a `COLLABORATIVE` lock on the file. When the user closes the editor (back button, swipe away, or JavaScript `close()` call), `EditorWebView.closeView()` and `ExternalSiteWebView.onDestroy()` only call `getWebView().destroy()` + `finish()` — no API call is made to tell the server that editing finished.

**Steps to reproduce:**

1. Ensure server has `files_locking` and `text` (or `richdocuments`) apps installed
2. Open a `.md` file that is not downloaded via the Android app
3. Observe the `COLLABORATIVE` lock being set on the server
4. Close the WebView editor (back button or via the close button)
5. The lock persists on the server

### Expected behaviour

When the editor WebView is closed, the app should signal the server to release the `COLLABORATIVE` lock.

### Actual behaviour

The `COLLABORATIVE` lock remains on the server indefinitely (until server-side timeout), blocking other users from editing.

### Android version

15

### Device brand and model

Fairphone 5

### Stock or custom OS?

Custom (explain in "additional information")

### Nextcloud android app version

34.0.1

### Nextcloud server version

34.0.1

### Using a reverse proxy?

No

### Android logs

_No response_

### Server error logs

```bash

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the editor lifecycle in EditorWebView.closeView() and ExternalSiteWebView.onDestroy(), then reproduce the issue with a non-downloaded .md file and verify the server's COLLABORATIVE lock. Check how the WebView editors signal editing completion. Done means closing through the back button, swipe-away, and JavaScript close() releases the server lock.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.