[Bug]: Original 'Date Modified' not preserved when restoring deleted files from trash
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
A folder with subfolders and files was accidentally deleted. After restoring, the folder and all its contents have the 'date modified' as the date-time the files were restored from trash.
Preferably the 'restore' option would preserve the file metadata from the time of deletion, as the file hasn't been modified in any way (from the user's perspective).
Steps to reproduce
- Delete an existing file/directory
- Restore from trash
- Compare 'date modified
Expected behavior
Preserve all pre-deletion metadata.
Nextcloud Server version
32
Operating system
Other
PHP engine version
PHP 8.4
Web server
Nginx
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
None
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
{
"system": {
"memcache.local": "\\OC\\Memcache\\APCu",
"memcache.distributed": "\\OC\\Memcache\\APCu",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 6369
},
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"***REMOVED SENSITIVE VALUES***"
],
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "31.0.12.3",
"overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
"overwriteprotocol": "https",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"enable_previews": true,
"enabledPreviewProviders": [
"OC\\Preview\\Movie",
"OC\\Preview\\PNG",
"OC\\Preview\\JPEG",
"OC\\Preview\\GIF",
"OC\\Preview\\BMP",
"OC\\Preview\\XBitmap",
"OC\\Preview\\MP3",
"OC\\Preview\\MP4",
"OC\\Preview\\TXT",
"OC\\Preview\\MarkDown",
"OC\\Preview\\OpenDocument",
"OC\\Preview\\PDF",
"OC\\Preview\\MSOffice2003",
"OC\\Preview\\MSOfficeDoc",
"OC\\Preview\\PDF",
"OC\\Preview\\Image",
"OC\\Preview\\Photoshop",
"OC\\Preview\\TIFF",
"OC\\Preview\\SVG",
"OC\\Preview\\Font",
"OC\\Preview\\MKV",
"OC\\Preview\\AVI",
"OC\\Preview\\MSOffice2007",
"OC\\Preview\\HEIC"
],
"loglevel": 2,
"preview_max_x": "2048",
"preview_max_y": "2048",
"jpeg_quality": "60",
"default_phone_region": "CA",
"app_install_overwrite": [
"previewgenerator",
"breezedark",
"impersonate",
"metadata",
"camerarawpreviews",
"workflow_media_converter",
"ransomware_protection",
"workflow_ocr",
"spreed"
],
"allow_local_remote_servers": true,
"mail_smtpmode": "smtp",
"mail_smtpsecure": "ssl",
"mail_sendmailmode": "smtp",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtpauthtype": "LOGIN",
"mail_smtpauth": 1,
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "465",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"skeletondirectory": "",
"maintenance": false,
"defaultapp": "files",
"theme": "",
"filelocking.enabled": "true",
"upgrade.disable-web": true,
"twofactor_enforced": "true",
"twofactor_enforced_groups": [
"admin"
],
"twofactor_enforced_excluded_groups": [],
"maintenance_window_start": 9,
"forbidden_filename_basenames": [
"con",
"prn",
"aux",
"nul",
"com0",
"com1",
"com2",
"com3",
"com4",
"com5",
"com6",
"com7",
"com8",
"com9",
"com\u00b9",
"com\u00b2",
"com\u00b3",
"lpt0",
"lpt1",
"lpt2",
"lpt3",
"lpt4",
"lpt5",
"lpt6",
"lpt7",
"lpt8",
"lpt9",
"lpt\u00b9",
"lpt\u00b2",
"lpt\u00b3"
],
"forbidden_filename_characters": [
"<",
">",
":",
"\"",
"|",
"?",
"*",
"\\",
"\/"
],
"forbidden_filename_extensions": [
" ",
".",
".filepart",
".part"
]
}
}
List of activated Apps
- activity: 4.0.0
- admin_audit: 1.21.0
- app_api: 5.0.2
- assistant: 2.12.0
- bruteforcesettings: 4.0.0
- camerarawpreviews: 0.8.8
- cloud_federation_api: 1.14.0
- comments: 1.21.0
- contacts: 7.3.9
- contactsinteraction: 1.12.1
- dav: 1.33.0
- federatedfilesharing: 1.21.0
- federation: 1.21.0
- files: 2.3.1
- files_accesscontrol: 2.0.3
- files_automatedtagging: 2.0.2
- files_downloadlimit: 4.0.0
- files_pdfviewer: 4.0.0
- files_reminders: 1.4.0
- files_sharing: 1.23.2
- files_trashbin: 1.21.0
- files_versions: 1.24.0
- flow_notifications: 2.0.1
- impersonate: 2.0.0
- logreader: 4.0.0
- lookup_server_connector: 1.19.0
- metadata: 0.23.0
- notifications: 4.0.0
- notify_push: 1.2.1
- oauth2: 1.19.1
- password_policy: 3.0.0
- photos: 4.0.0
- previewgenerator: 5.11.0
- privacy: 3.0.0
- profile: 1.0.0
- provisioning_api: 1.21.0
- recommendations: 4.0.0
- related_resources: 2.0.0
- richdocuments: 8.7.7
- serverinfo: 3.0.0
- settings: 1.14.0
- sharebymail: 1.21.0
- spreed: 21.1.7
- support: 3.0.0
- suspicious_login: 9.0.1
- systemtags: 1.21.1
- text: 5.0.2
- theming: 2.6.1
- twofactor_backupcodes: 1.20.0
- twofactor_totp: 13.0.0-dev.0
- user_status: 1.11.0
- viewer: 4.0.0
- weather_status: 1.11.0
- webhook_listeners: 1.2.0
- workflow_ocr: 1.31.3
- workflowengine: 2.13.0
Disabled:
- circles: 31.0.0 (installed 28.0.0-dev)
- dashboard: 7.11.0 (installed 7.8.0)
- encryption: 2.19.0 (installed 2.11.0)
- files_external: 1.23.0
- firstrunwizard: 4.0.0 (installed 2.12.0)
- nextcloud_announcements: 3.0.0 (installed 1.12.0)
- ransomware_protection: 1.14.0 (installed 1.14.0)
- survey_client: 3.0.0 (installed 1.11.0)
- twofactor_nextcloud_notification: 5.0.0
- updatenotification: 1.21.0 (installed 1.17.0)
- user_ldap: 1.22.0
- workflow_media_converter: 1.15.1 (installed 1.15.1)
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
N/A
Additional info
N/A
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the files_trashbin app's restore flow for deleted files and directories, then inspect how the original modified timestamp is stored and reapplied. Reproduce the listed delete-and-restore steps and verify that restored items retain their pre-deletion date-modified metadata.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mariadb, php
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100