nextcloud / nextcloud/server

Write correct modification times on external storage (files_external)

Open
#56,903 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage enhancement feature: external storage hotspot: file time handling
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

[!TIP]

Help move this idea forward
  • Use the 👍 reaction to show support for this feature.
  • Avoid commenting unless you have relevant information to add; unnecessary comments create noise for subscribers.
  • Subscribe to receive notifications about status changes and new comments.

Is your feature request related to a problem? Please describe.

I recently tried to bring together my smb network shares and my files in Nextcloud. After some tests I realized the modification time of files uploaded to external storage is always equalling the upload time. In the web ui the file uploaded shows the modification time of the original file uploaded (i.e some days ago) but the actual file on the external storage shows the creation time as the modification time. A file uploaded to the external storage directly (i.e. via smb) keeps the modification time. This leads inconsistent modification times on the external storage which is especially frustrating when dealing with pictures or other time relevant files.

Describe the solution you'd like

I would like files uploaded via Nextcloud to an external storage to keep the modification time of the original file. Just like when uploading to normal "internal" storage.

Describe alternatives you've considered

I tested with smb and sftp as external storage, but the behaviour was the same. The only alternative I could come up with is to do some bind mounting to the internal storage, but this either results in "bad" file ownership (i.e. www-data) or could have strange side effects when mounting smb to an internal storage.

Additional context

Here some stat output from files I tested with:

  • Screenshot_1730744151.png was uploaded via Nextcloud to the configured smb external storage
  • IMAG1140_BURST002_COVER.jpg was uploaded directly via smb to the extenal storage
$ stat Screenshot_1730744151.png 
  File: Screenshot_1730744151.png
  Size: 2166      	Blocks: 9          IO Block: 2560   regular file
Device: 0,101	Inode: 36865       Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1001/    nick)   Gid: ( 2004/   photo)
Access: 2025-12-07 19:05:24.448452138 +0100
Modify: 2025-12-07 19:05:23.446535961 +0100
Change: 2025-12-07 19:05:23.584448502 +0100
 Birth: 2025-12-07 19:05:23.420447812 +0100
$ stat IMAG1140_BURST002_COVER.jpg 
  File: IMAG1140_BURST002_COVER.jpg
  Size: 2674104   	Blocks: 5393       IO Block: 131072 regular file
Device: 0,101	Inode: 38050       Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1001/    nick)   Gid: ( 2004/   photo)
Access: 2025-12-07 19:21:26.640495612 +0100
Modify: 2014-12-18 15:24:28.000000000 +0100
Change: 2025-12-07 19:21:01.772391400 +0100
 Birth: 2025-12-07 19:21:01.608390714 +0100

For reference a file in the internal storage:

$ stat aegis.png 
  File: aegis.png
  Size: 507291          Blocks: 992        IO Block: 4096   regular file
Device: 0,45    Inode: 10419807    Links: 1
Access: (0644/-rw-r--r--)  Uid: (   33/www-data)   Gid: (   33/www-data)
Access: 2025-12-07 22:42:00.406950287 +0000
Modify: 2022-09-18 15:22:42.000000000 +0000
Change: 2025-12-07 22:42:00.359951207 +0000
 Birth: 2025-12-07 22:42:00.342951540 +0000

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not name a file, test, or entry point. Start by tracing how uploads to SMB and SFTP external storage set file metadata, then compare that path with internal storage. Done means uploaded external files retain the source file's modification time, with coverage for the reported external-storage behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.