Commit Graph
191 Commits
Author SHA1 Message Date
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 9c15a7e4b1 Tell a deployment that mounts thumbnails/files where its cache goes 2026-10-26 09:34:33 +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 afdaace67a docs(webdav): name every thumbnail variable that stopped doing anything 2026-10-21 14:54:07 +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 ef5e9c2e6e docs: name who decides what instead of what a thumbnail is 2026-10-20 20:39:15 +02:00
Dominik Schmidt 9f3e51b89d docs(webdav): say what an existing deployment has to change
Environment names keep working, a yaml configuration does not: its keys belong to the section of the service that reads them, and an unknown key is ignored without a word.
2026-10-20 20:22:10 +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
Dominik Schmidt 4f79fdf9bb fix(webdav): hash the checksum that becomes the cache key
The checksum is not this service's to trust, an OCM share takes it from a remote PROPFIND, and it ends up as a path on disk and as an S3 object key.
2026-10-20 16:02:39 +02:00
Dominik Schmidt ab29d4848f fix(webdav): keep the deprecated cache root pointing at its files directory
THUMBNAILS_FILESYSTEMSTORAGE_ROOT named the directory the old service kept files/ in, so reading it as the cache directory moved the cache one level up and left the existing thumbnails behind.
2026-10-20 16:01:52 +02:00
Dominik Schmidt 56d96d2df8 fix(webdav): say it when the thumbnail cache fails to answer
Only a miss is silent now; every other error from the cache is logged instead of disappearing behind a regenerated thumbnail.
2026-10-20 14:59:08 +02:00
Dominik Schmidt 260d6f0bbd fix(webdav): a missing s3 bucket is not a cache miss
Matching any 404 let a typo in the bucket name read as a miss on every lookup; only NoSuchKey, and a 404 that carries no code at all, are misses now.
2026-10-20 14:58:46 +02:00
Dominik Schmidt fa73366ff0 fix(webdav): read the generator's status before the writer's error
A 429 or 413 is answered without reading the body, which breaks the write; the broken pipe used to mask the status. A 413 now reads as too large, not as a server fault.
2026-10-20 14:58:09 +02:00
Dominik Schmidt 89e2f42d7c refactor(webdav): ask ForType for options, not for an any map 2026-10-19 15:16:06 +02:00
Dominik Schmidt ee4465f500 fix(webdav): stop refusing a type mapping on a guess about the generator 2026-10-19 14:57:36 +02:00
Dominik Schmidt 48f9990a41 fix(webdav): ask the generator for the smart crop
A cropping resize now carries imagor's smart segment, which is how the libvips
build and a real imagor keep the region that carries the image, the way main
cropped before the generator moved out. A build without libvips answers the
same request with a centre crop, and the parity suite records that.
2026-10-19 14:57:36 +02:00
Dominik Schmidt c980083938 docs: say less in the comments, and name what matchOperation returns 2026-10-19 14:57:36 +02:00
Dominik Schmidt 999ad6fb7c fix: answer the review from @orgaralf
Both builds and imagor now crop the same region, a gif is bounded by its
declared frames, the posted body by THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE and an
image extracted from a container by the configured input size. The s3 cache
reads a miss where minio reports it.

The push endpoint's HTTP behaviour is asserted in the parity suite now, where
imagor answers the same request, so 41 duplicated service specs are gone and
the 32 that remain are what a non-default config or a helper decides.
2026-10-19 14:57:36 +02:00
Dominik Schmidt a6fcc8dc58 docs: the thumbnail settings are only checked with previews enabled
Two readme sentences promised a startup refusal without saying that nothing reads these settings when OC_DISABLE_PREVIEWS is set, so a typo surfaces when previews come back on.
2026-10-19 14:57:36 +02:00
Dominik Schmidt 4da8971ca7 docs: say what the code does, in the places that still described something else
The aspect-ignored header blamed a processor for a decision the free axis can make too. fit-in does not letterbox, it answers smaller than the box. The s3 cache checks bucket, region and credentials, not the endpoint. A mapping onto a type the generator cannot write is refused at startup instead of quietly becoming a JPEG. And a processor name nobody knows resolves like none, which three comments and a readme line still denied.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 1da9fa8013 fix: answer the third review round
With previews off a thumbnail path answered 405, because the REPORT patterns match the same paths and the GET routes were left out; the routes stay now and the shared parse step answers 404, which is what the setting promises. The deprecated cache directory is read again: its default no longer sits in the config struct, where it made the fallback unreachable. A processor nobody knows is treated like none, in the parser too. A comma-joined resolutions entry in yaml keeps working. Plus the comments and the readme line that described something else than the code does.
2026-10-19 14:57:35 +02:00
Dominik Schmidt c5c5ec2e2c refactor(webdav): own the list of types a preview is announced for
The thumbnails service kept a single map of supported mime types that nothing in that service used any more, only webdav read it, and the comment still claimed reva reads it there. It is webdav's announcement, so DefaultSourceTypes lives next to SourceTypes now, the leftover package is gone, and no webdav file imports the thumbnails service any longer.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 67856fdf6d fix: the small things the review left over
A processor that needs the whole box is not a cropping one, so targetsExactBox says what it decides. An output format without an encoder answers 406 like every other thing this build cannot write. The configured defaults are no longer seeded twice, the constructors merge them anyway, like they do for the source types. And webp needs no build tag: both builds read it, the pure Go one answers the JPEG the mapping asks for, which the parity suite pins.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 3572410fc4 fix: answer the review, and read imagor's path the way imagor does
The push endpoint takes an empty filters segment, ignores an image key behind the box and computes a side given as 0 from the other one, all measured against both imagors and pinned in the parity suite. Plus the review leftovers: no em dashes, the request test on ginkgo, comments that contradicted the code, one stat for Head and generate, one thumbnail handler, the gif fit-in rounding of vips, and the new env names last so they win.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 85b7cccc02 docs: fix what the thumbnail readmes get wrong
The a and processor defaults, that every named processor overrules a, the shared OC_THUMBNAIL_* names, the gif output type, the ladder making the response a different size, the empty filters segment that answers 404, and 406 instead of 400 for a format the build cannot write.
2026-10-19 14:57:35 +02:00
Dominik Schmidt f4792a0b02 fix(webdav): keep the acceptance contract for previews
An explicit x=0 or y=0 is an error again, only an omitted axis is unconstrained, and the text preview fixtures carry the resolution the generator writes now.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 6c9dc28599 refactor: one gif resize, a request struct, half the routes
The gif loop is shared by both builds, the executor takes a request
struct, the route table halves, the aspect flag is a pointer instead of
two bools, and the cache's budget is named after what it is.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 99c7666ad2 fix(webdav): make the legacy a flag mean something again
An unconstrained axis is fitted instead of refused, a decides when the
client sent it, and an empty resolution ladder is refused at startup
instead of letting the client pick the cache key.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 918c2baa7d fix(webdav): refuse what it cannot serve and pass the generator through
A cache backend nobody can serve fails at startup instead of dropping
entries silently, the memory backend is bounded, a busy generator's 429
reaches the client with its Retry-After, and a 400 from the generator is
read as this service's own bug instead of a missing preview.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 70002306a8 docs: describe the push endpoint and the preview settings as they are
The fixtures are named after what they are, and the leftovers of the
deleted grpc service are gone.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 9879927f4f refactor(webdav): a converter returns the image bytes and their type
A converter that found nothing returns nil, so the workflow decides what to
do with it instead of reading an error.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 32f4ee02e8 feat(webdav): let a deployment add the types a preview is made of
webdav, graph and ocdav read the same list, so a configured type is
announced and attempted by all three. A type the generator cannot answer
is refused at startup, and ocdav takes the types from its own
configuration instead of importing an OpenCloud package, which the
vendored reva carries until opencloud-eu/reva#885 lands.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 07d6829bd6 fix(webdav): hand an embedded image to the generator as it was found
Nothing is decoded in webdav any more, which also ends the libvips build
split in the preview path.
2026-10-19 14:57:35 +02:00
Dominik Schmidt de467d7dd8 feat(webdav): write a thumbnail in the type the source maps to
A source type maps onto the type its thumbnail is returned in, and that
type is asked for by the name the generator knows it under. The answer
carries that type whether it was just generated or came from the cache,
which is also what the cache key says.
2026-10-19 14:57:35 +02:00
Dominik Schmidt 0f734ac32c fix(webdav): type the upload part and answer the small things
The multipart part carries the source's own type, because imagor's upload
loader accepts image/* only. A public link that needs a password is a 404 again, a preview carries
nosniff and a content length, and the input size limit is read with reva's
bytesize again.
2026-10-19 14:57:35 +02:00