[Bug]: Restoring a file from trash loses version labels and authors, exposing named versions to expiration
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start by reading FileEventsListener.php around remove_hook() and deleteVersionsEntity(), then follow how LegacyVersionsBackend.php recreates version entries and how Trashbin.php restores files. Reproduce the steps with a named historical revision and compare its label and author before deletion and after restoration. Done means restoration preserves the revision contents, label, author, and expiration protection.
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 (if unsure, ask the Community Help Forum).
- This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
- I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
- 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
Bug description
On Nextcloud Server 35.0.3, deleting a file from a shared folder and restoring it from trash preserves all revision contents but loses version labels and author metadata.
This is particularly important because named versions are excluded from automatic expiration. Losing a version label may expose a previously protected revision to automatic deletion under the configured retention policy.
Actual behavior
| Property | Before deletion | After restoration |
|---|---|---|
| File ID | 104149 | 104156 |
| Number of revisions | 3 | 3 |
| Revision IDs | Original | Preserved |
| Revision contents | Original | Identical |
| Version timestamps | Original | Preserved |
| Named version | Trash-probe-checkpoint | null |
| Version authors | mcp | null |
All three revisions were successfully read and compared before and after restoration.
Environment
- Nextcloud Server 35.0.3
- Nextcloud All-in-One
- User-to-user shared folder
- WebDAV client: nextcloud-mcp-server v0.226.3
versions_retention_obligation:"7, 30"trashbin_retention_obligation:"90, 365"
Possible cause
In the current implementation, historical version files are moved to trash and subsequently restored.
However, FileEventsListener::remove_hook() calls deleteVersionsEntity(), while LegacyVersionsBackend::getVersionsForFile() can recreate missing version database entries with empty metadata.
This appears to explain why version contents survive while labels and authors are lost.
Relevant source files:
The loss of metadata was reproduced experimentally. Subsequent automatic expiration of a previously named revision is a potential consequence and has not yet been tested.
Related issues: #53152, #2103, #21567.
Steps to reproduce
- Create a text file in a folder shared by another local user.
- Modify the file twice to create three distinct revisions.
- Assign a name to one historical revision.
- Verify the version labels, authors and contents.
- Delete the file normally.
- Restore the file from trash using the same account.
- Compare the restored version history with its original state.
Expected behavior
Restoring a file from trash should preserve its historical revisions, including version labels and author metadata.
Named versions should retain their protection against automatic expiration.
Nextcloud Server version
35
Operating system
Other
PHP engine version
None
Web server
None
Database engine version
None
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response
- Ngôn ngữ chính
- PHP
- Star
- 37.6k
- Fork
- 5.4k
- Merge trung bình
- 1 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 623
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 NeededĐ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
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ự
-
Độ 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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sonata-project/SonataAdminBundle#8426 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
erkamyaman/rust-anything#942 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CPU core labels missing for Low-Power E-cores on hybrid Intel CPUs (Arrow Lake-H) — get_intel_core_types() ignores /sys/devices/cpu_lowpowerCó thể đã có người làm @dgongut đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày