Commit Graph
5416 Commits
Author SHA1 Message Date
Pascal Bleser 26a7b4f903 feat: 1419: add a command to clean up old revisions on demand
'opencloud storage-users revisions cleanup' deletes old revisions,
according to a cleanup strategy, of:

- the files of spaces (--space, repeatable),
- or of a file or folder within a space (--space with --path),
- or of all spaces (--all),
- or of a file or folder given by its path on disk (--fs-path, posix
  only).

The id of a file or folder is rejected as the id of a space, as the
command would otherwise clean up its whole space. So is an id without a
space id, e.g. 'storage$'.

The storage-users service only cleans up the revisions of a file when it
gets a new one. The command also covers the files that are not changed
anymore, and applies a different strategy once.

The strategy and the settings of the background workers default to the
configured ones (STORAGE_USERS_REVISIONS_CLEANUP_*), and can be
overridden with --strategy, --async, --workers and --queue-size. Only
--queue-full defaults to 'block' without a timeout, whatever is
configured: the command finds files faster than the workers clean them
up, so dropping the files that find the queue full, or giving up after
the timeout meant for uploads, would skip most of them.
--queue-full-timeout sets one for the run.

The command uses the storage driver directly, in its own process, like
'uploads sessions': posix neither scans nor watches the file system, and
no driver joins the postprocessing consumer group of the service.

For posix, the driver needs NATS for its event stream. The command waits
for it 10 seconds at most, instead of the 15 minutes the stream retries
for, and ctrl-c also stops that wait: with the single binary, NATS only
runs within the server (opencloud-eu/opencloud#3805). The driver gets
the logger of the command: posix passes it on to the NATS connections
of its id cache, whose handlers would panic on a lost connection
without one. Ctrl-C also stops waiting for the driver, e.g. for the id
cache, which retries for up to 15 minutes as well.

Unless it is a dry run, which changes nothing on disk, the command
warns when the storage belongs to another user than the one it runs as,
e.g. root: the lock files it creates belong to that user, and the
server may not be able to lock these files anymore.

Output: a line for every file whose revisions were deleted, that failed
or that was skipped, with its path within its space, and a summary;
--verbose adds every file and every revision with the decision and its
reason; --json prints the same as JSON objects, one per line, with a
final summary object. --dry-run deletes nothing.

--timeout stops the cleanup gracefully, as does ctrl-c, and a second
ctrl-c ends the command right away, which can leave the blob of a
deleted revision behind; the help says so. Whether the timeout or ctrl-c
stopped the cleanup is told by the contexts of the command, not by the
error: the storage can return context errors of its own. --shuffle walks
the spaces and folders in a random order, so that repeated runs that
are stopped by the timeout, e.g. from a cron job, eventually reach all
files. The help explains that a file waiting for a lock can't be
interrupted, and that a dry run changes nothing on disk, but decides on
a snapshot, as it doesn't keep the files locked while it decides.

The common flags have short forms: -a (--all), -p (--fs-path),
-s (--strategy), -n (--dry-run), -v (--verbose), -j (--json) and
-t (--timeout).

Exit codes:

- 0 when done,
- 1 if the cleanup or any file failed, or if it was interrupted,
- 2 if the timeout stopped the cleanup before all files were cleaned
  up.

The storage-users README documents the command, along with the cleanup
strategies and how they relate to the configured cleanup.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 23:59:43 +01:00
Pascal Bleser 7676730860 feat: 1419: configure the revision cleanup of the storage-users drivers
Wire reva's revision cleanup options into the 'decomposed', 'decomposeds3'
and 'posix' drivers, in the storage provider and in the data provider.

The options are a single 'revisions_cleanup' section of the storage-users
configuration, next to 'filemetadata_cache' and 'id_cache', as only one
driver is used at a time. Its environment variables:

- STORAGE_USERS_REVISIONS_CLEANUP_STRATEGY: which old revisions to
  delete whenever a file gets a new revision, e.g. 'auto', '30d' or
  '7d, auto, 90d'
- STORAGE_USERS_REVISIONS_CLEANUP_ASYNC: run the cleanup in background
  workers
- STORAGE_USERS_REVISIONS_CLEANUP_ASYNC_WORKERS: number of background
  workers
- STORAGE_USERS_REVISIONS_CLEANUP_ASYNC_QUEUE_SIZE: number of files that
  can wait
- STORAGE_USERS_REVISIONS_CLEANUP_ASYNC_QUEUE_FULL: 'drop' or 'block'
- STORAGE_USERS_REVISIONS_CLEANUP_ASYNC_QUEUE_FULL_TIMEOUT: how long
  'block' waits for room at most, 0 for as long as it takes

The strategy defaults to 'disabled', which keeps all revisions as before.
The other defaults are reva's: background workers, with the number of
workers and the queue size determined automatically, dropping the
cleanup of a file when the queue is full (it is cleaned up with its
next revision), and a timeout of 5s for 'block'.

Other commands that create a driver, 'posixfs scan' and 'uploads
sessions', clean up revisions without background workers: they could
exit before the workers are done, and stop the cleanup of a file
midway.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 23:59:43 +01:00
Sara Ahmadi dc749a39bb Merge pull request #4097 from asaah262/fix/857-auth-app-user-not-found
fix: return 404 when creating an app token for an unknown user
2026-11-23 19:03:29 +01:00
Florian Schade 9afb99f54a Merge pull request #4096 from fschade/feat-search-photo-props-numeric-ranges
feat(search): return photo metadata and allow ranges on numeric fields
2026-11-23 17:33:06 +01:00
Florian Schade ba5da33c42 Merge pull request #4094 from fschade/fix-search-reindex-walk
fix(search): descend into unchanged folders and skip failed uploads
2026-11-23 17:32:42 +01:00
Sara Ahmadi 41112716fe fix: return 404 when creating an app token for an unknown user
Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 16:11:30 +01:00
Florian Schade 5fe4935e7f feat(search): return photo metadata and allow ranges on numeric fields 2026-11-23 15:47:15 +01:00
Jörn Friedrich Dreyer 9f1fbc4480 fix(ocs): never hand out signing keys to link visitors
A public link token carries the link owner as user. If a link visitor
ever reaches GetSigningKey they get the owner's signing key and can sign
urls for everything the owner can read, until the key expires. Today the
proxy public paths and the reva link scope keep visitors away from the
endpoint, this adds the check in the handler itself.

We now refuse guests and users with a public-share-role in the opaque,
before reading or creating the key.

ported from https://github.com/owncloud/ocis/pull/12332
related: https://github.com/opencloud-eu/omega/issues/879

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-11-23 15:33:15 +01:00
Florian Schade 4c25436e4e fix(search): descend into unchanged folders and skip failed uploads 2026-11-23 15:33:09 +01:00
Alex Ababii d43947a209 Merge pull request #3876 from maki5/feat/personal_space_permissions
feat(permissions): new permissions for personal spaces
2026-11-23 13:05:40 +01:00
opencloudeu 627c375c03 [tx] updated from transifex 2026-11-20 23:17:33 +00:00
Alex Ababii ddea1f00c3 feat(permissions): upd permissions description 2026-11-20 17:24:04 +01:00
Alex Ababii bd23beb0f1 feat(permissions): new permissions for personal spaces 2026-11-20 17:24:04 +01:00
Jörn Friedrich Dreyer 2dc0668893 Merge pull request #4073 from dragonchaser/backport-wp3-778
fix(graph): keep the given expiration time of public links
2026-11-20 09:30:42 +01:00
Alex Ababii 1bf81a7ff1 fix(graph): upd guest share type for driveitems 2026-11-19 16:57:24 +01:00
Alex Ababii b93909a5c7 fix(graph): upd driveItem details to return guest type 2026-11-19 16:57:24 +01:00
Alex Ababii 10e231e13a fix(graph): tmp handle the share type guest on drive items info 2026-11-19 16:57:24 +01:00
Roman Perekhod 436fb35dbb Fix the expiration date response for links 2026-11-19 15:48:14 +01:00
opencloudeu c97aff7230 [tx] updated from transifex 2026-11-18 23:17:11 +00:00
Pascal Bleser e6c2215bab Merge pull request #3891 from pbleser-oc/fix/3889-get-tags-sorted-limit
fix(graph): list the tags in use sorted and cut at a fixed limit
2026-11-18 19:36:03 +01:00
Jörn Friedrich Dreyer c0a334f173 Merge pull request #4032 from opencloud-eu/feat/disable-new-shares
feat(sharing): allow disabling the creation of new shares
2026-11-18 13:33:38 +01:00
Pascal Bleser 7ed534d191 fix(graph): sort the listed tags in byte order
Byte order is the order in which search engines sort keyword values,
e.g. an OpenSearch terms aggregation ordered by key. With the same
order, the search can return just the first tags of every space, and
merging those lists still gives exactly the first tags overall. A
case-insensitive order would need an aggregation on a lowercased copy
of the field, with a mapping change, a reindex and the loss of the
original casing.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-18 11:28:47 +01:00
Pascal Bleser f45248336a fix(graph): list the tags in use sorted and cut at a fixed limit
GetTags collected the tags of all search results into a tags.Tags
object, which is meant for the tags of a single resource: it stops
accepting tags at 100 and puts new tags in front. So when more than 100
distinct tags were in use, the response held an arbitrary 100 of them,
and the order changed with the order of the search results.

Collect the distinct tags, sort them case-insensitively (ties in byte
order), and cut the list at the documented constant maxListedTags (100).
An empty list is still rendered as "value": [].

Fixes #3889

Assisted-by: Claude Code:claude-opus-5-5
2026-11-18 11:01:55 +01:00
Andre Duffeck f8a8ecf724 Merge pull request #3966 from opencloud-eu/fix/postprocessing-uploadready-without-upload
fix(postprocessing): ignore UploadReady events without an upload
2026-11-18 10:34:31 +01:00
Andre Duffeck 9200fac9b8 Merge pull request #4030 from opencloud-eu/fix/search-debouncer-double-run
fix(search): run the debounced work once when both timers fire
2026-11-18 10:28:04 +01:00
Pascal Bleser 5b9e691484 Merge pull request #4017 from pbleser-oc/feat/tag-length-validation
feat(graph): limit the length of tags
2026-11-18 09:36:52 +01:00
Andre Duffeck edacb0e01f Merge pull request #4036 from opencloud-eu/feat/graph-expose-favorites
feat(graph): expose the favorite state on drives and sharedWithMe
2026-11-18 08:45:39 +01:00
Pascal Bleser a359ef7e85 feat(graph): limit the length of tags
Tags could be of any length. Assigning tags through the graph API now
rejects the whole request with 400 if one of the tags is longer than the
maximum, listing the tags that are too long. The length is counted in
characters, after the whitespace around each tag is removed. Tags that
already exist are not affected.

The maximum is 100 characters by default, and can be changed with
OC_MAX_TAG_LENGTH, or turned off with 0. The frontend service announces
it to clients as the graph.tags.max_tag_length capability, so that they
can check tags before sending them. Both services read the same
variable, without a service-specific alias, so that the announced limit
is always the one graph enforces.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-18 00:29:40 +01:00
opencloudeu f35dcd5718 [tx] updated from transifex 2026-11-17 23:17:37 +00:00
Sara Ahmadi 1668aa8b71 Merge pull request #4035 from asaah262/fix/4018-permissions-top-query-option
fix(graph): keep the permissions list query options with $top=0
2026-11-17 16:13:12 +01:00
Sara Ahmadi 8174209bb4 Merge pull request #4038 from asaah262/feat/1041-instrument-get-permission
feat(graph): add logging and tracing to the single-permission GET endpoints
2026-11-17 15:56:39 +01:00
Jörn Friedrich Dreyer 34d5ffe173 feat(sharing): allow disabling the creation of new shares
We now have two global opt-out switches that stop users from creating
new shares while everything that already exists keeps working:

OC_DISABLE_NEW_USER_SHARES rejects new user, group and federated shares
in graph and reva. Adding members to a space is still possible: graph
skips space roots, based on the stat result, like reva does.

OC_DISABLE_NEW_PUBLIC_LINKS rejects new public links and turning an
internal link into a public link in reva.

The frontend, graph, sharing and ocm services read them. Both default
to false.

We bump reva to 37496dc6abd3, which contains
https://github.com/opencloud-eu/reva/pull/1022

Ported from `owncloud/ocis#12542`, with the flags inverted.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-11-17 15:36:28 +01:00
Viktor Scharf 3b43e2a425 bump opencloud version to 9.2.0 (#4033)
* bump opencloud version to 9.2.0

* docs: set removal version 9.1.1 for deprecated options (#4029)
2026-11-17 14:39:14 +01:00
Sara Ahmadi 5a818b6f41 feat(graph): add logging and tracing to the single-permission GET endpoints
Assisted-by: Claude Code:claude-opus-5-5
2026-11-17 14:02:05 +01:00
Alexander Ackermann d2b1ab3c45 feat(graph): expose the favorite state on drives and sharedWithMe
Spaces and received shares can be marked as favorites, but the graph
API did not report it, so the web app could not show them.

drive.root and the sharedWithMe driveItems now carry
@libre.graph.me.following. The space root info only holds the requested
quota metadata, so the per-user flag is also read from the favorites
list the storage driver adds to the opaque.

Fixes #2511
2026-11-17 13:36:41 +01:00
Sara Ahmadi ccba4a5e49 fix(graph): keep the permissions list query options with $top=0
Assisted-by: Claude Code:claude-opus-5-5
2026-11-17 13:10:40 +01:00
Alex 0ec0411e75 chore: bump web to v8.3.0 (#4027)
Assisted-by: Claude Code:claude-opus-5-5
2026-11-17 13:09:44 +01:00
André Duffeck 2b77cb9a17 Bump reva to v3.0.1 2026-11-17 12:45:18 +01:00
Dominik Schmidt ca733e731f fix(search): run the debounced work once when both timers fire
Every pending space has a debounce timer and a timeout timer, and both
call the same work function. The function checked for a run in progress
before taking the mutex, so when both timers were due together, both
calls passed the check and the space was indexed twice at the same
time.

Take the mutex first and return when the work item is no longer the
pending one.

This is also what made "fires at the timeout even when continuously
debounced" flaky: its two timers are due about 50ms apart, which is
close enough on a busy CI runner.
2026-11-17 12:06:59 +01:00
Jörn Friedrich Dreyer 2032e85c83 Merge pull request #4011 from pbleser-oc/test/4010-thumbnail-cache-test-race
test(webdav): fix a data race in the thumbnail cache test
2026-11-17 10:03:03 +01:00
Jörn Friedrich Dreyer a8a10db244 docs(gateway): reword the caching paragraphs
With only the provider cache left the "it uses one cache:" sentence
followed by a list with a single entry read odd, so name the provider
cache in the sentence instead.

Also tell admins where the create home cache went. Someone searching
the README for GATEWAY_CREATE_HOME_CACHE_* now finds that the envvars
are gone and that the proxy remembers which users already have a
personal space.

Assisted-by: Claude Code:claude-fable-5-2
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-11-17 08:36:59 +01:00
Roman Perekhod 0cc21c5039 fix: move the home space create cache to the proxy
The gateway kept a cache of the users whose personal space had already
been created, but the proxy still sent a CreateHome request to the
gateway on every authenticated request, so each of them had to reach
the gateway before that cache could help.

Keep the set of users whose personal space exists in the proxy instead
and skip the gateway call for them. The set lives in memory only: after
a restart the first request of each user simply asks the gateway once
more, so persistence is not needed. A created and an already existing
personal space are both remembered, a failed attempt is not and gets
retried by the next request.

With the cache in the proxy the gateway no longer needs its own, so
remove the create home cache settings (GATEWAY_CREATE_HOME_CACHE_*) and
the create_personal_space_cache_config entry of the generated gateway
configuration, and update the gateway README accordingly.
2026-11-17 08:36:59 +01:00
opencloudeu 9ed89daff7 [tx] updated from transifex 2026-11-16 23:17:18 +00:00
Sara Ahmadi 16ba119131 Merge pull request #4019 from asaah262/test/907-permissions-select-allowed-values
test(graph): cover $select on the permissions list endpoints
2026-11-16 19:11:06 +01:00
Sara Ahmadi 146397ef73 test(graph): cover $select on the permissions list endpoints
Assisted-by: Claude Code:claude-opus-5-5
2026-11-16 18:10:30 +01:00
Sara Ahmadi dc891683eb fix(graph): hide private user attributes from other users
Assisted-by: Claude Code:claude-opus-5-5
2026-11-16 13:03:58 +01:00
Pascal Bleser 41196f511e test(webdav): fix a data race in the thumbnail cache test
The test "should use atomic write via temp file + rename" set
sawTempFile in a watcher goroutine and read it after close(done),
without waiting for the goroutine to stop, so the race detector failed
TestCache.

Make sawTempFile an atomic.Bool and wait for the watcher to return
before reading it.

Fixes #4010

Assisted-by: Claude Code:claude-opus-5-5
2026-11-16 12:38:00 +01:00
Sara Ahmadi 2ff7018524 Merge pull request #3992 from asaah262/refactor/graph-unified-role-labels
refactor(graph): keep the unified role labels in one place
2026-11-16 10:09:55 +01:00
Pascal Bleser 5853b9b598 fix(graph): return the drive id in remoteItem.parentReference.driveId
For received shares, remoteItem.parentReference.driveId held the id of
the root item of the drive (<storage>$<space>!<root>) instead of the id
of the drive (<storage>$<space>), unlike all other drive items. Clients
had to cut off the root part themselves to request /drives/{drive-id}.

Use the drive id for user and OCM shares, and expect it in the
acceptance tests of the shared with me listing.

Fixes #3997

Assisted-by: Claude Code:claude-opus-5-5
2026-11-16 09:33:47 +01:00
opencloudeu 15d181d3f4 [tx] updated from transifex 2026-11-13 23:17:01 +00:00