Moving folders with the same name on local external storage can replace the existing folder and delete its contents

未关闭
#17,773 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
docker, kotlin
领域
backend

调研方向

The report names no files or tests; it describes a folder MOVE onto an existing same-named folder on local external storage. Start by reproducing with two "2026" folders and confirming whether the client sends a WebDAV MOVE and how the destination-exists branch is handled, including whether files_trashbin is bypassed. Done means the destination is preserved (merge/refuse/confirm) and a regression test covers the same-name move on external storage.

由索引模型根据 Issue 内容生成。

描述

0. Needs triage bug
⚠️ Before posting ⚠️
  • This is a bug, not a question or an enhancement.
  • I've searched for similar issues and didn't find a duplicate.
  • I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
  • I agree to follow Nextcloud's Code of Conduct.
Steps to reproduce

I experienced apparent data loss when moving folders with the same name inside a Nextcloud local external storage mount.

I have Nextcloud AIO running on Windows with Docker Desktop. A Windows NTFS folder is exposed to Nextcloud as local external storage.

The affected path is:

"F:\NextcloudExternal\Gallery\Pictures"

There were two folders named:

"2026"

When I moved one "2026" folder into the location containing the other "2026" folder, I expected Nextcloud to either:

  1. merge the contents of the two folders, or
  2. warn that a folder with the same name already exists and require confirmation before replacing anything.

Instead, the existing "2026" folder was replaced. Its previous contents disappeared.

The deleted files did not appear in:

  • Nextcloud Trash
  • Windows Recycle Bin

The source files were actually removed from the Windows NTFS filesystem.

I was able to recover the deleted data using Windows File Recovery ("winfr"). A targeted recovery scan recovered 808 files, including the original directory structure:

"NextcloudExternal\Gallery\Pictures\2026\08"

and files such as:

"26-08-23 20-38-56 5397.jpg"

This indicates that the files were actually deleted/replaced on the underlying external storage rather than simply disappearing from the Nextcloud file index.

Steps to reproduce

  1. Configure a Nextcloud local external storage mount pointing to a writable Windows folder.
  2. Create two separate folders named "2026" in different locations.
  3. Put different files in each "2026" folder.
  4. Using android or ios app or web move one "2026" folder into the location containing the other "2026" folder.
  5. Observe the resulting destination folder.
Expected behaviour

Nextcloud should not silently destroy the contents of an existing same-named folder.

Possible expected behaviors would be:

  • merge the folders while preserving all files, or
  • refuse the operation because the destination already exists, or
  • clearly warn that the destination will be replaced and require explicit confirmation.

If replacement is intentionally supported, the existing folder's contents should be recoverable through Nextcloud Trash where the external-storage backend supports it.

Actual behaviour

Actual behavior

The existing "2026" folder was replaced and its previous contents disappeared.

The deleted files were not present in Nextcloud Trash or the Windows Recycle Bin.
The Nextcloud activity section did mentioned that 2026 folder is removed.
The files were actually deleted from the underlying Windows NTFS filesystem.

Windows File Recovery was subsequently able to recover 808 files from the affected folder.

Impact

This can result in unexpected permanent data loss when users move folders with names that already exist at the destination.

This is particularly concerning for local external storage because the operation directly affects the underlying filesystem.

Environment

  • Nextcloud: Nextcloud AIO
  • Deployment: Docker Desktop
  • Host OS: Windows
  • Docker context: "desktop-linux"
  • External storage type: local folder / local external storage
  • Host filesystem: NTFS
  • External storage root:

"F:\NextcloudExternal"

  • Affected path:

"F:\NextcloudExternal\Gallery\Pictures"

  • Affected folder:

"2026"

Additional information

The external storage was intentionally limited to:

"F:\NextcloudExternal"

The entire "F:" drive was not exposed to Nextcloud.

Docker was able to access the external storage correctly.

After the incident, Windows showed only the remaining "2025" folder under:

"F:\NextcloudExternal\Gallery\Pictures"

The missing "2026" folder was not present.

No files from the missing folder were found in either Nextcloud Trash or the Windows Recycle Bin.

Windows File Recovery was run against the NTFS volume and successfully recovered 808 files from the affected "2026" directory, confirming that the underlying files had been deleted.

Related reports

I found several existing Nextcloud reports involving external-storage move/delete behavior, including:

  • #63168 — deletion on external storage can succeed even though the client receives an error.
  • #54977 — move/copy and delete-folder problems involving external storage.
  • #39516 — move operations involving external storage can copy data and fail during deletion.
  • #37934 — files on local external storage can be deleted when the external storage becomes unavailable.

However, I did not find an existing report describing this exact same-name-folder replacement scenario on local external storage.

Request

Please investigate whether moving a folder onto an existing folder with the same name can cause the destination folder to be replaced/deleted rather than safely merged or rejected.

In particular, please verify:

  1. How the Files app handles a directory MOVE operation when the destination directory already exists.
  2. Whether the operation can recursively delete the existing destination contents.
  3. Whether the operation bypasses "files_trashbin" for local external storage.
  4. Whether the behavior differs between normal Nextcloud storage and local external storage.
  5. Whether the UI should prevent or explicitly warn about this operation.

I can provide additional logs, configuration information, or a reproduction test if needed..

Android version

15

Device brand and model

onplus 10 pro

Stock or custom OS?

Stock

Nextcloud android app version

35.0.0

Nextcloud server version

latest

Using a reverse proxy?

No

Android logs

No response

Server error logs

Additional information

No response

主要语言
Kotlin
星标
5.7k
派生
2.1k
平均合并
1 天 22 小时
30 天内合并 PR
135

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nextcloud/android 的其他 Issue

查看 nextcloud/android 的全部 Issue

相似的 Issue

更多 Kotlin Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。