Rename within the same folder answers HTTP 500 where a move to another folder answers 423/403: `Node::setName()` does not convert `LockedException`, `ForbiddenException` and a refused rename
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu với apps/dav/lib/Connector/Sabre/Node.php và so sánh Node::setName() với Directory::moveInto() trong apps/dav/lib/Connector/Sabre/Directory.php. Issue chỉ ra các chuyển đổi ngoại lệ còn thiếu và các phản hồi HTTP dự kiến: thao tác đổi tên bị khóa phải trả về 423, còn thao tác đổi tên bị cấm hoặc bị từ chối phải trả về 403. Kiểm tra các bài kiểm thử DAV về phản hồi khi đổi tên và di chuyển, sau đó xác nhận ba trường hợp được báo cáo không còn trả về 500.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
⚠️ This issue respects the following points: ⚠️
- This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug.
- This issue is not already reported on Github OR solved at the Community Help Forum.
- I'm using a maintained major version of Nextcloud Server and tested against the latest patch level.
- I agree to follow Nextcloud's Code of Conduct.
- I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description
A WebDAV MOVE whose source and destination are in the same folder (a rename) answers 500 with an internal exception in three situations where the same MOVE to another folder answers 423 or 403:
| Situation | Rename in the same folder | Move to another folder |
|---|---|---|
| the file is being read by another request | 500 OCP\Lock\LockedException |
423 FileLocked |
| the node is a mount point that cannot be moved (a team folder) | 500 OCP\Files\ForbiddenException: Storage … cannot be moved |
403 Forbidden |
the storage refuses the rename (rename() returns false) |
500 Sabre\DAV\Exception: Failed to rename … to … |
403 Forbidden |
Every such answer also writes an error with a full stack trace to nextcloud.log ("Uncaught exception"), for an ordinary refusal.
We met the first one on a working server: a background process (the full text search indexer) was reading files, and 1 of 430 renames of just uploaded files failed with 500.
Steps to reproduce
Users alice and bob, both in group team. $DAV is https://<server>/remote.php/dav/files.
1. The file is locked
- Upload a 300 MB file as
alicetod/big.bin; create the folderd/other. - Start a slow download:
curl -u alice:<password> --limit-rate 2M -o /dev/null $DAV/alice/d/big.bin - While it runs:
curl -u alice:<password> -X MOVE -H "Destination: $DAV/alice/d/renamed.bin" $DAV/alice/d/big.bin
Result: 500, <s:exception>OCP\Lock\LockedException</s:exception>, "/d/big.bin" is locked.
At the same moment a MOVE to d/other/big.bin, a PUT over the file and a DELETE all answer 423 OCA\DAV\Connector\Sabre\Exception\FileLocked.
2. A mount point that cannot be moved (app groupfolders 23.0.1)
occ groupfolders:create Team,occ groupfolders:group <id> team read write share delete.- As
alice:MOVE $DAV/alice/Team→$DAV/alice/Teamx.
Result: 500, OCP\Files\ForbiddenException, Storage Team cannot be moved.
MOVE $DAV/alice/Team → $DAV/alice/sub/Team answers 403.
3. The storage refuses the rename (app groupfolders 23.0.1, advanced permissions)
occ groupfolders:permissions <id> --enable; asalicecreateTeam/NoCreate/ren.txt.occ groupfolders:permissions <id> NoCreate --group team -- -create- As
bob:MOVE $DAV/bob/Team/NoCreate/ren.txt→$DAV/bob/Team/NoCreate/ren2.txt.
Result: 500, Sabre\DAV\Exception, Failed to rename /Team/NoCreate/ren.txt to /Team/NoCreate/ren2.txt.
The same with -write instead of -create. PUT of a new file into NoCreate and a MOVE of a file into it answer 403.
Here oc:permissions of the file is RMGDNVW and of the folder RMGDNV: DavUtil::canRename() allows the rename because the file is updatable, while the storage wrapper of groupfolders also wants Create on the target and returns false.
Expected behavior
The answers a move to another folder gives: 423 in case 1, 403 in cases 2 and 3.
Nextcloud Server version
35
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.5
Web server
Apache (supported)
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
Default configuration of the Docker image nextcloud:35.0.3-apache, PostgreSQL 18.7. File locking is on with its default provider (database), no Redis.
List of activated Apps
Default apps of the image, files_external and groupfolders 23.0.1 (cases 2 and 3). Also enabled, with no indexer running: fulltextsearch 35.0.1, files_fulltextsearch 35.0.1, fulltextsearch_elasticsearch 35.0.1.
Nextcloud Signing status
No response
Nextcloud Logs
Case 1, MOVE /remote.php/dav/files/alice/d/big.bin
OCP\Lock\LockedException: "/d/big.bin" is locked
lib/private/Files/View.php:2130 OC\Files\View->changeLock()
lib/private/Files/View.php:797 OC\Files\View->rename()
apps/dav/lib/Connector/Sabre/Node.php:150 OCA\DAV\Connector\Sabre\Node->setName()
3rdparty/sabre/dav/lib/DAV/Tree.php:171 Sabre\DAV\Tree->move()
3rdparty/sabre/dav/lib/DAV/CorePlugin.php:612 Sabre\DAV\CorePlugin->httpMove()
Case 2, MOVE /remote.php/dav/files/alice/Team
OCP\Files\ForbiddenException: Storage Team cannot be moved
lib/private/Files/View.php:903 OC\Files\View->validateMountMove()
lib/private/Files/View.php:810 OC\Files\View->rename()
apps/dav/lib/Connector/Sabre/Node.php:150 OCA\DAV\Connector\Sabre\Node->setName()
3rdparty/sabre/dav/lib/DAV/Tree.php:171 Sabre\DAV\Tree->move()
Case 3, MOVE /remote.php/dav/files/bob/Team/NoCreate/ren.txt
Sabre\DAV\Exception: Failed to rename /Team/NoCreate/ren.txt to /Team/NoCreate/ren2.txt
apps/dav/lib/Connector/Sabre/Node.php:151 OCA\DAV\Connector\Sabre\Node->setName()
3rdparty/sabre/dav/lib/DAV/Tree.php:171 Sabre\DAV\Tree->move()
3rdparty/sabre/dav/lib/DAV/CorePlugin.php:612 Sabre\DAV\CorePlugin->httpMove()
Additional info
Nextcloud 35.0.3 (Docker image nextcloud:35.0.3-apache: Debian 13, PHP 8.5.13, Apache 2.4.71), PostgreSQL 18.7, groupfolders 23.0.1.
Cause
Sabre\DAV\Tree::move() (3rdparty/sabre/dav/lib/DAV/Tree.php:168-171) calls setName() of the source node when source and destination have the same parent, and moveInto() of the destination folder otherwise. Both end in the same View::rename(), but only one of them converts its refusals:
OCA\DAV\Connector\Sabre\Directory::moveInto()(apps/dav/lib/Connector/Sabre/Directory.php:459-469):rename()returned false →Sabre\DAV\Exception\Forbidden;StorageNotAvailableException→ServiceUnavailable;ForbiddenException→Forbidden;LockedException→FileLocked.OCA\DAV\Connector\Sabre\Node::setName()(apps/dav/lib/Connector/Sabre/Node.php:136-157): notry;rename()returned false → the baseSabre\DAV\Exception(:151), which is a 500.LockedExceptionandForbiddenExceptionleave the method as they are and become a 500 too. The method's own doc block lists@throws LockedException.
master has the same code in both methods today.
Fix
The same conversion in setName() as in moveInto(): false → Forbidden, and the three catch blocks.
- Ngôn ngữ chính
- PHP
- Star
- 37.6k
- Fork
- 5.4k
- Merge trung bình
- 1 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 625
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nextcloud/server
-
[Bug]: Axios Update NeededCó thể đã có người làm @HaoKaedehara đã nhận hôm nay. Đang mở0. Needs triage 35-feedback bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nextcloud/server#67135 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
34-feedback
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: GET /js/../<anything> returns 500 (NotPermittedException from JsController::getJs) instead of 404Có thể đã có người làm @lazerg đã nhận 7 ngày trước. Đang mở35-feedback
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Dashboard widgets registered via OCA.Dashboard.register() sometimes never mount (spinner forever) – Vue 3 non-deep `callbacks` watcher raceCó thể đã có người làm @lazerg đã nhận 7 ngày trước. Đang mở35-feedback
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của nextcloud/server
Issue tương tự
-
[Resource]: FlavianĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
hesreallyhim/awesome-claude-code#3736 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
nhrrob/nhrrob-secure#34 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100