Repository navigation
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.
Shares, tags, comments, metadata and /f/ links all key on fileid, the auto-increment id of oc_filecache. It survives renames and moves in current code, also across storages. It does not survive a cache rebuild, a rescan of external storage after cache loss, or a migration to another instance. On primary object storage the objects are named urn:oid:<fileid>, so the object only has an identity because of a database row.
This has bitten users before: file ids on external storage kept changing and broke share links (#31373), and moving folders in or out of a share on object storage changed the file id and lost shares and favourites (#31870). With #59345 (encryption keys stored by file id) the file id is becoming even more load-bearing.
For working material this is an inconvenience. For records that must stay referenceable for decades, for example from published decisions or answers to freedom-of-information requests, it is a defect.
Describe the solution you'd like
- A durable id per file next to
fileid(a UUID), kept on rename and move, also across storages. A copy gets a new one. - A storage backend may supply this id itself, for example from its own record identifier. Nextcloud uses it in preference to generating one.
- Where Nextcloud generates the id, it writes it to the backend when it can (object metadata on S3), so a rescan finds it back.
- The id resolves to the current location:
/f/<id>, a WebDAV property, and a lookup in the public API.
As a first step shares and tags keep keying on fileid. The durable id is added and exposed first; moving associations onto it can follow.
Describe alternatives you've considered
oc:id. It is unique across instances, but it is built fromfileidplus the instance id (DavUtil::getDavFileId), so it breaks in exactly the same cases.- Storing a UUID as files metadata. It has no uniqueness guarantee or lookup index, and it is lost with the cache unless it also lives in the backend.
- Leaving it to apps. Every app would invent its own, and none of them could recover it after a rescan.
Additional context
Related to #66498 (deletion events should carry this id) and #66355 (metadata shown on the object should name this id). We (Conduction) would like to build and maintain this, with tests.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTo triage
Activity
susnux commentedon Nov 10, 2026
The file id should already be stable, if it is not then this is a bug that must be fixed.
What is out of scope is moving files outside of Nextcloud, this cannot be tracked.
There is no "cache" to rebuild,
filecacheis not a cache its the main file system table of Nextcloud.Truncating it is basically resetting you Instance and must never be performed.
Similar here a "cache" loss is basically the same as completely dropping your filesystem - the solution here is rollback to your backup.
Not sure what this means, if you migrate your instance you always also have to migrate your existing database.
rubenvdlinde commentedon Nov 17, 2026
Thanks @susnux, that's a fair correction. I used "cache" loosely and agree:
filecacheis the file system table, and losing it means restoring a backup, not something to design for. I'll update the title and description of this issue.Two things remain.
1. A case where file ids change. While testing #66498 we found one on an external S3 mount: when the bucket refuses the deletes (a policy denying
s3:DeleteObject), deleting a folder returns 204, nothing is deleted, and after the rescan of the mount the folder's files come back with new file ids (106–109 became 110–113). We saw that with the trashbin enabled and disabled. Shares and tags on the old ids are gone. Following your point that unstable file ids are a bug, the details are in #66498, since the cause is the same:batchDelete()never reads the per-key errors.2. One id per record across versions. Ferdinand told us hash-based file identity is planned for this cycle. We welcome that: archives need a fixity value per version to show a file is unchanged. They also need an id that stays the same when a new version is saved, so a decision or a published reference keeps pointing at the same record. Is that part of the planned design, or is the hash per version only? If it is per version, we'd like to discuss a stable record id next to it rather than build something separate.
[-]Durable object identity that survives a cache rebuild[/-][+]Stable record identity across versions, alongside hash-based file identity[/+]