nextcloud / nextcloud/server

Create `CACHEDIR.TAG` in `appdata_xxx/preview` for easy exclusion from backups

Open
#57,668 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage enhancement feature: previews and thumbnails
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.

Preview data directories can grow to be quite large (mine is 356GB) but have no need to be backed up since all their data can be regenerated at-will. Nextcloud should give backup tools some help avoiding storing a bunch of unnecessary cache data.

Describe the solution you'd like

CACHEDIR.TAG is a de-facto standard for indicating that a directory contains only cached data, with wide support (for example, tar, BorgBackup, Restic, and Duplicati all support this standard).

Nextcloud should automatically write CACHEDIR.TAG, with the correct magic contents, to appdata_xxx/preview/CACHEDIR.TAG upon creation of the parent directory. (At least, it should do this when the data storage driver is the local filesystem and not e.g. object storage.)

Describe alternatives you've considered

Document this directory as one that should probably be excluded from backups.

Additional context

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

Search the PHP code that creates the appdata_xxx/preview directory and inspect how the local filesystem storage driver is identified. Add the standard CACHEDIR.TAG with its required magic contents when that directory is created, excluding object storage, and verify that the tag appears in the intended preview path.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.