[Bug]: Restoring a file from trash loses version labels and authors, exposing named versions to expiration

オープン
#67,077 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
backend, databases

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

0. Needs triage 35-feedback bug
⚠️ 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
  1. Create a text file in a folder shared by another local user.
  2. Modify the file twice to create three distinct revisions.
  3. Assign a name to one historical revision.
  4. Verify the version labels, authors and contents.
  5. Delete the file normally.
  6. Restore the file from trash using the same account.
  7. 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

主要言語
PHP
スター
37.6k
フォーク
5.4k
平均マージ
1日 13時間
マージ済み PR(30日)
623

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nextcloud/server のほかの issue

nextcloud/server の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。