Commit Graph
200 Commits
Author SHA1 Message Date
Dominik Schmidt a059ae8179 test(webdav): drop the newTika helper again
It only saved the preset argument, the other three still vary per call,
and the calls changed anyway, so the diff got larger rather than smaller.
2026-12-02 16:47:28 +01:00
Dominik Schmidt 0ac1ea8e30 fix(webdav): trim the Tika thumbnail preset once in Sanitize
The check trimmed the preset but the URL took it untrimmed, so " thumbnail"
started fine and then answered 404 for /unpack/preset/%20thumbnail. Sanitize
trims it now and Validate only compares against "". The tests build their
Tika through a helper that sets the default preset.
2026-12-02 16:43:53 +01:00
Dominik Schmidt 17a9874be2 feat(webdav): make the Tika thumbnail preset configurable
OC_TIKA_THUMBNAIL_PRESET (WEBDAV_TIKA_THUMBNAIL_PRESET) names the catalog
preset webdav unpacks thumbnails with, "thumbnail" by default. A preset of
your own has to bring the same filter, only the raster images Tika marks as
THUMBNAIL or RENDERING, since webdav takes the first image in the answer.
An empty preset fails at startup.

Changing the preset needs the thumbnail cache emptied, as a Tika upgrade
does.
2026-12-02 16:22:19 +01:00
Dominik Schmidt e6acfb721d Merge pull request #3332 from opencloud-eu/feat/thumbnails-raw-embedded-preview
feat(webdav): extract thumbnails through Tika
2026-12-02 12:13:30 +01:00
Dominik Schmidt 4443a8f9fc fix(webdav): bound a kept source only by the cache's own limit 2026-11-27 16:40:33 +01:00
Dominik Schmidt 253b2d4d52 fix(webdav): key the source cache by extractor, keep no empty entry per size 2026-11-27 16:40:24 +01:00
Dominik Schmidt 081a0a71ec fix(webdav): hash the source cache key like the thumbnail key 2026-11-27 16:40:15 +01:00
Dominik Schmidt d27aaa403f docs(webdav): split the thumbnail README by topic, with setups as a table 2026-11-27 16:40:05 +01:00
Dominik Schmidt 3716c65704 fix(webdav): cache a file the built-in extractors find no image in, as for Tika 2026-11-27 16:39:56 +01:00
Dominik Schmidt 82735a337d fix(webdav): give every thumbnail type exactly one taker
A named Tika type goes to Tika, then the built-in converters, then images
to the generator, then the rest to Tika under "*" or to the generator.
"*" never sends an image, which only moved the file to come back empty,
and an announced type without a converter reaches the generator again, as
it does on main since the generator pass-through.
2026-11-27 16:39:43 +01:00
Dominik Schmidt d326bbd54f fix(webdav): send m4b audiobooks to Tika for their cover 2026-11-27 16:39:34 +01:00
Dominik Schmidt f2a15e9434 docs: correct what an empty Tika type list does, and couple the two ceilings in writing
The description said an empty list leaves the built-in list in place, which is
what an unset variable does; an explicitly empty one sends nothing. And a ladder
that reaches past the generator's output ceiling asks for a box the generator
refuses, which nothing checks for us, so the thumbnails README says it.
2026-11-27 16:39:23 +01:00
Dominik Schmidt ff964dcc22 refactor(webdav): ask who can serve a type, not what the type is called
ForType decided by the name of the type: anything starting with image/ was
handed to the generator, and no converter meant handing it over as well. A
camera raw is an image by that rule, so it travelled to a generator that cannot
read it, and an announced pdf travelled there too. It now asks in one order who
claims the file: a type the Tika list names, an image the generator reads, a
converter here, a catch-all, and otherwise nobody, which answers 404 before the
file is read at all.

The Tika list carries the formats a release serves a thumbnail for, the camera
raws among them, and the default config hands it in, so an empty list still
means nothing goes to Tika and a shared server stays the search service's.
OC_TIKA_ADDITIONAL_THUMBNAIL_MIME_TYPES adds to it.
2026-11-27 16:39:10 +01:00
Dominik Schmidt 92dab13caa docs(webdav): say what the Tika type hint is for
The type decides which parser reads the file, so a raw photo that Tika only detected as a plain tiff is parsed as a tiff and its embedded preview is never found. No shipped format needs the hint, which is why the knob reads like dead code and has to say that it is not.
2026-11-27 16:38:57 +01:00
Dominik Schmidt f24659fdf4 refactor(webdav): keep the Tika type default in the default config
The catch-all was hidden in NewTika, so neither the yaml nor the env documentation showed it. It is a plain default now, like the CORS origins, and an empty list means what it says: nothing goes to Tika, and the server behind OC_TIKA_URL stays the search service's.
2026-11-27 16:38:44 +01:00
Dominik Schmidt 31b6cf6bd9 docs(webdav): say how a Tika before 4.2.0 activates the preset
Both answer with the same image for the same file, only the package differs, and a 4.1.x server has no preview for erf, orf and rw2. The 404 now names both ways to activate the preset.
2026-11-27 16:38:29 +01:00
Dominik Schmidt 5d98850cd9 feat(webdav): extract a source image once per file, not once per size
What an extractor makes of a file does not depend on the size that was asked
for, so it is kept under one key per file and read before the file is even
downloaded. An empty entry says the file carries nothing, which keeps the
next size from asking Tika again; a failed extraction is not remembered. The
file cache now replaces what a key holds, as the other two backends already
did, because an entry whose value can change has to be replaceable.
2026-11-27 16:38:20 +01:00
Dominik Schmidt 6b2c30219c refactor(webdav): let the preprocessor say what a type needs
The cache key is derived from configuration again: a thumbnail is written in
the type the file's own type maps to, so the answer no longer depends on what
Tika hands back and needs no placeholder in the key.

Which types Tika gets is decided in one place now. An image type goes to Tika
only when a deployment names it, because the generator behind the URL may read
it itself, which also lets a raw photo reach Tika at all.
2026-11-27 16:38:09 +01:00
Dominik Schmidt 9dbe0b7956 feat(webdav): use Tika's merged thumbnail preset
Tika merged the thumbnail catalog preset and ThumbnailUnpackSelector
(TIKA-4856): PUT /unpack/preset/thumbnail returns exactly the one raster
image a client would show for the document, a stored thumbnail, the
rendering of a metafile thumbnail, or the rendered first page. The
client-side selection over /unpack/all (embedded-resource-type marks,
metafile renderings, id-path matching) moves to the server; the preset
zip carries one image without metadata sidecars, so the entry's
extension names the type and the bytes break the tie. The preset has to
be active, so this needs a Tika 4.2.0 or newer started with
TIKA_PRESETS=thumbnail, and a 404 says so.
2026-11-27 16:37:50 +01:00
Dominik Schmidt 69e13657e4 feat(webdav): take the thumbnail tika marks, and the rendering of a metafile 2026-11-27 16:37:41 +01:00
Dominik Schmidt 1c7b19f009 feat(webdav): thumbnails through a Tika server
Every file the built-in converters cannot render goes to /unpack/thumbnail
(Tika 4.1) and comes back with the image Tika marks as its thumbnail.
2026-11-27 16:36:39 +01:00
Dominik Schmidt 3abf08b85f feat(search): offset paging with a stable order
The search service takes a `from` offset next to the page size and applies it after the cross-space merge; every space answers the full prefix up to from+size, since an offset cannot be distributed. Pages are stable: both engines and the merge break score ties by id, and OpenSearch counts every match (track_total_hits). No engine pages beyond the first 10000 matches, the OpenSearch result window, so a from and size reaching beyond it are rejected on both engines. `page_size` becomes optional on the wire: absent is the default of 200, 0 asks for no matches, -1 for all; WebDAV and the tags listing set it accordingly, and the WebDAV report's `<oc:offset>`, parsed since the report exists and never read, now pages the merged list. The gRPC wrapper passes the request through and keys its cache by the whole request.
2026-11-27 15:50:35 +01:00
Dominik Schmidt c3d9b93238 test(webdav): cover every photo field and a hit without facets 2026-11-23 18:03:37 +01:00
Dominik Schmidt 927df2bdce feat(webdav): carry the facets in the search REPORT hits
The search service returns audio, location, image, photo, video, motion photo and live photo with every hit, the REPORT response only carried photo and location, as flat oc:photo-* props. All facets are now rendered in the xml shape PROPFIND uses, so a client reads both the same way. This replaces the flat props.
2026-11-23 17:44:23 +01:00
Florian Schade 5fe4935e7f feat(search): return photo metadata and allow ranges on numeric fields 2026-11-23 15:47:15 +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
André Duffeck 2b77cb9a17 Bump reva to v3.0.1 2026-11-17 12:45:18 +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
Jörn Friedrich Dreyer c88d94ea2b Merge pull request #3986 from pbleser-oc/fix/graph-space-image-size
fix(graph): refuse space images too large for a thumbnail
2026-11-13 18:28:35 +01:00
Pascal Bleser 51b92da2e5 fix(graph): refuse space images too large for a thumbnail
A space image is only ever shown as a thumbnail. When a file larger
than the thumbnail generator accepts was set as the image of a space,
the PATCH of the drive succeeded, but no thumbnail could be made of the
file, so the space showed no image and nobody got an error.

Before setting the image, graph now looks up the size of the file, and
refuses a file above the limit with 413 Request Entity Too Large,
without changing the space. The limit is the one of the thumbnail
generator: graph reads it under the same names as the webdav and
thumbnails services (OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE and the
older THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE, 50MB by default, empty for
unlimited), so one setting keeps the three in agreement.
GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE sets a lower limit for space
images alone.

The default of 50MB is now one constant, which the graph, webdav and
thumbnails services all use.

Only the file size is checked: the dimension limits of the generator
would need the whole image to be read. The space readme has no limit,
and an empty image id is passed on unchecked, as before.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-13 15:55:12 +01:00
Jörn Friedrich Dreyer 0d969c3179 thumbnails: drop the enable_vips build flag
The thumbnails service now always resizes in pure Go. Deployments that
want more formats, webp output or an attention crop run a real imagor
and point WEBDAV_THUMBNAILS_GENERATOR_URL at it. The built-in service
stays as a minimal fallback that keeps working when imagor or libvips
have to be taken out, for example during a security issue.

Without cgo dependencies the docker images link statically again and no
longer need the vips packages. The vips parity run in CI goes away, the
regular test run already covers the pure Go build.

The preview fixtures of the acceptance tests were rendered by libvips,
so they are regenerated with the pure Go build. Text previews now lose
their left edge: the 640x480 text canvas is filled into a square box
and the pure Go build crops the centre, where libvips' attention crop
kept the left side with the text.

part of https://github.com/opencloud-eu/opencloud/issues/3912

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-11-12 15:41:35 +01:00
Andre Duffeck 5d0440378d Merge pull request #3884 from opencloud-eu/fix/webdav-generator-passthrough
fix(webdav): stream announced types without a converter to the generator
2026-11-03 14:45:04 +01:00
Dominik Schmidt e462b8ce27 fix(webdav): stream announced types without a converter to the generator 2026-11-03 11:34:16 +01:00
micbar 4e7ebd4f8c fix: only trust forwarding headers from trusted reverse proxies
chi's ClientIPFrom* header middlewares trust the header from anyone who can
  reach us. Pick the middleware per request instead: headers are only read
  when the peer is a trusted proxy, everyone else gets their network address.

  - PROXY_TRUSTED_PROXIES, defaults to loopback and private ranges
  - PROXY_CLIENT_IP_HEADER, defaults to X-Forwarded-For, e.g. CF-Connecting-IP
  - drop the strategy setting and xff_trusted_hops
  - pass the client address to the services in X-Forwarded-For instead of
    X-Client-Ip, reva reads it e.g. for OCM
  - same check in collaboration, traefik routes to it directly
  - OC_TRUSTED_PROXIES and OC_CLIENT_IP_HEADER set both services
  - the other services only drop RealIP, none of them reads the address

  Taken from #3864 and https://github.com/opencloud-eu/opencloud/pull/3464#issuecomment-6494799883

# Conflicts:
#	services/proxy/README.md
2026-10-30 15:15:22 +01:00
Alex Ababii cf0f06e060 select correct chi middleware to get real IP based on config values 2026-10-30 15:13:55 +01:00
Alex Ababii 850f1714a1 upd deprecated chi RealIP middelware 2026-10-30 15:13:54 +01:00
Viktor Scharf ae4970d92c chore: bump reva to 2.52.0 (#3820) 2026-10-27 12:46:43 +01:00
André Duffeck e78b40e4d5 Keep the thumbnail cache apart from the old thumbnails
The cache keys changed, so the old files were never read again but stayed mixed in with the new ones. With the cache in its own directory the old one can be deleted.
2026-10-23 14:21:41 +02:00
André Duffeck 489f00288d Look up the user of a thumbnail path with the requester's token
Without it the user provider searched with an empty tenant.
2026-10-23 14:20:13 +02:00
André Duffeck 46982c265a Read the thumbnail input size limit in the same order as the generator
With both the old and the new name set, webdav and the thumbnails service picked different values.
2026-10-23 14:18:36 +02:00
André Duffeck 658688d18e Cap legacy thumbnail resolutions at 2048
The old default list reached 7680x4320, which made webdav ask the generator for boxes it refuses.
2026-10-23 14:17:15 +02:00
Dominik Schmidt 8e508e56c2 refactor: name the settings that extend a default list additional_*
They are merged onto the built-in defaults, the way the proxy's additional_policies and OC_ADD_RUN_SERVICES are, so the name says it: env variable, yaml key and field all carry the prefix. The two that take key:value entries are named in the plural like the other map-shaped settings in this repo, and the README says which of the three takes bare mime types.
2026-10-23 10:18:30 +02:00
Dominik Schmidt 8a80d75363 refactor(webdav): keep ignoring the legacy a flag
OpenCloud never honored it, so clients were tested against an ignored a and honoring it now would change what they get.
2026-10-21 14:22:54 +02:00
Dominik Schmidt f7e8817433 refactor(webdav,graph,frontend): put the thumbnail settings in a thumbnails block
Every service that configures thumbnails now carries one thumbnails section whose keys are named like the setting itself, so webdav's thumbnails.max_input_image_file_size and the thumbnails service's thumbnail.max_input_image_file_size read the same, and a key's path matches its env name. Env names are unchanged.
2026-10-21 13:11:40 +02:00
Dominik Schmidt 9c327dc34a docs: let the comments say what the code does, not what it used to do
A comment that explains a decision by what another branch or the previous service did stops being true the moment this merges.
2026-10-20 20:22:10 +02:00
Dominik Schmidt c490926ce3 refactor: name the thumbnail config fields like their yaml keys
Internal only: the fields in webdav, graph and frontend now read Thumbnails like the keys and the variables they carry. The generator keeps its released thumbnail block, field and key alike.
2026-10-20 18:40:39 +02:00
Dominik Schmidt a5dd8143a5 refactor: name the thumbnail yaml keys like their variables
The keys are new in this PR, nothing has them set: a yaml file configures webdav's thumbnail settings under the webdav section, so the key now reads like the variable without its service prefix.
2026-10-20 18:37:44 +02:00
Dominik Schmidt c6ac8748d8 refactor: name the thumbnail settings after the service, THUMBNAILS
The service is thumbnails and its released variables say so; the new ones said THUMBNAIL. None of them has shipped yet, so they are renamed rather than aliased. The input file size gains the shared OC_THUMBNAILS_ name, because webdav and the generator have to agree on it.
2026-10-20 18:08:34 +02:00
Dominik Schmidt 4e85772b47 fix(webdav): stop the resolution ladder at 2048
The largest rung is the largest box a generator is asked for, and fill and stretch enlarge a small source to fill it, so the rungs above 2048 let a tiny image cost whatever 8K costs. Web asks for 1200 at most.
2026-10-20 16:56:28 +02:00
Dominik Schmidt 41b7160f3a fix(webdav): the source type belongs in the cache key
The same bytes uploaded under two types are not the same thumbnail: the type picks the extractor, and with Tika in front what it finds depends on it.
2026-10-20 16:03:06 +02:00