Commit Graph
155 Commits
Author SHA1 Message Date
Dominik Schmidt 75893c19ee refactor(thumbnails): thread context.Context through the preprocessor Convert interface
The Tika preview extractor does a network call; it was using context.Background().
Pass the request context from the gRPC handler through Convert so the unpack call
respects cancellation and deadlines. Non-I/O decoders ignore the context.
2026-08-19 18:45:11 +02:00
Dominik Schmidt c286f771c9 fix(thumbnails): use the %%NEXT%% introductionVersion placeholder the CI check requires 2026-08-19 18:40:32 +02:00
Dominik Schmidt 73b839f120 test(thumbnails): route httptest writes through a helper to satisfy codacy 2026-08-19 18:37:34 +02:00
Dominik Schmidt afd82fba5b chore: share the Tika URL via OC_TIKA_URL across search and thumbnails 2026-08-19 18:22:19 +02:00
Dominik Schmidt 63582cb310 fix(thumbnails): pass source filename so Tika selects its raw parser
Tika sniffs TIFF-based raws (NEF/DNG/ARW/PEF) as generic image/tiff by
content; only the filename extension routes them to the raw parser. Thread
the source name through to the unpack request via Content-Disposition.
2026-08-19 18:22:19 +02:00
Dominik Schmidt 7bdbad3319 feat(thumbnails): extract raw previews via Tika instead of in process
Replace the in-process TIFF/BigTIFF walker (rawtiff.go) with a Tika-based
extractor: raw images are sent to a Tika server's /unpack endpoint, which
returns the embedded JPEG previews (Tika's RawTiffParser emits them as embedded
documents). The largest renderable JPEG is decoded through the image pipeline.

This aligns preview extraction with the search service (same Tika, same format
coverage) and drops a large hand-rolled parser. Raw thumbnails now require
THUMBNAILS_TIKA_TIKA_URL; without it, raw types fall back to the default decoder
(no thumbnail).

Audio artwork extraction stays in process for now and moves in a follow-up.
2026-08-19 16:30:29 +02:00
Dominik Schmidt 882325c512 fix(thumbnails): follow SubIFDs pointers typed IFD/IFD8
isLongType accepted only LONG/LONG8, so a SubIFDs entry using the dedicated
IFD (13) or, in BigTIFF, IFD8 (18) pointer type (both standards-compliant and
common) was skipped and its embedded preview never discovered. Accept those
pointer types for the SubIFDs tag via isSubIFDType, keeping the stricter
isLongType on length fields so they never accept a pointer type. IFD8 reads at
8-byte width like LONG8.
2026-08-19 11:54:06 +02:00
Dominik Schmidt b5e1222ec8 fix(thumbnails): overflow-safe BigTIFF bounds and correct LONG offset width
Review of #3332 surfaced two BigTIFF-only defects in the embedded-preview
walker (attacker-controlled input):

- 64-bit IFD and SubIFD-array offsets were bounds-checked with `off + n > len`,
  which wraps for a crafted offset near 2^64, bypassing the guard and slicing
  out of range -> panic (recovered by the framework into a 500 + stack log on
  every crafted request, defeating the no-panic goal). Now overflow-safe.
- a tag value was always read as an 8-byte Uint64 in BigTIFF; a LONG (4-byte)
  offset in a big-endian BigTIFF was thereby shifted. Read it at its declared
  type width instead.

Adds tests for the overflow paths (assert ErrNoImageFromRawFile, no panic),
the big-endian LONG offset, and strengthens the truncation test to assert the
error. Trims a few over-long comments.
2026-08-19 11:24:50 +02:00
Dominik Schmidt 47a7136c46 feat(thumbnails): support BigTIFF containers for raw previews (DNG 1.7) 2026-08-19 07:30:53 +02:00
Dominik Schmidt 6ade518690 test(thumbnails): expand raw preview coverage and quiet previewless logging
Add big-endian, largest-candidate, orientation-direction, isRenderableJPEG
classification and maxPreviewLength tests plus a ForType raw-dispatch check;
log a raw file without an embedded preview at debug instead of error; name the
TIFF magic constant and de-enumerate the decoder doc comment.
2026-08-18 16:48:32 +02:00
Dominik Schmidt 8dec34dbd4 fix(thumbnails): cap the served raw preview length
Reject a preview whose declared length exceeds 100MB rather than serving it;
previews are camera-generated JPEGs, so this bounds the output independently
of the input file size.
2026-08-18 16:48:32 +02:00
Dominik Schmidt f112e8bfb2 feat(thumbnails): register Nikon NRW and Sony SRF raw previews
Both are TIFF-based camera raw formats handled by the same generic walker;
NRW detection needs the reva mimetype mapping in opencloud-eu/reva#773, SRF is
already mapped. No sample files on hand for these two, added by format
structure alongside their verified siblings.
2026-08-18 16:48:32 +02:00
Dominik Schmidt 61ce147205 fix(thumbnails): harden the raw tiff walker against crafted files
Cap the IFD queue at maxIFDs so a file packed with huge SubIFD counts can no
longer grow it without bound, and walk the embedded JPEG by a bounded number
of header segments so a preview whose SOF sits past 64KB of leading metadata
is still found instead of being scanned only within a fixed byte window.
2026-08-18 16:48:32 +02:00
Dominik Schmidt b02d4fb279 chore(thumbnails): gofmt 2026-08-18 16:48:32 +02:00
Dominik Schmidt 9805f65136 chore(thumbnails): tighten rawtiff comments 2026-08-18 16:48:32 +02:00
Dominik Schmidt 5b26d202b5 feat(thumbnails): serve raw previews for CR2, PEF, ARW, SR2 and DNG
Rename RawImageDecoder to RawTiffDecoder and qualify candidates by their
actual stream instead of trusting the tags: CR2 keeps its full-size JPEG
as an IFD0 strip, DNG stores the raw sensor payload as lossless JPEG
(SOF3) which starts with a regular SOI. A JPEG segment walk to the SOF
marker accepts only the DCT processes common decoders render.
2026-08-18 16:48:32 +02:00
Dominik Schmidt c0069c9e77 feat(thumbnails): serve the embedded jpeg preview of nikon raw files 2026-08-18 16:48:31 +02:00
Ralf Haferkamp fab1986fb6 Revert "fix: disallow thumbnails for tiff and jpeg2000 images"
The alpine base images now has a fixed libvips. So we can enable
previews for these formats again.

This reverts commit c40629dd85.
2026-06-18 11:53:03 +02:00
Ralf Haferkamp c40629dd85 fix: disallow thumbnails for tiff and jpeg2000 images 2026-05-13 13:28:10 +02:00
Florian Schade d0e3f14539 chore: remove loop var references 2026-04-23 17:11:55 +02:00
Florian Schade 288e67cc39 chore: replace interface with any 2026-04-23 09:31:11 +02:00
Christian Richter 30c4fb2b51 consolidate log config in thumbnails
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
2026-01-08 13:38:14 +01:00
Florian Schade 9c651af32d fix(thumbnailer): missing font panic 2025-12-31 12:17:11 +01:00
Florian Schade 01b768d33c fix(thumbnailer): respect image boundaries and text wrappings for TxtToImageConverter string drawing 2025-12-22 15:57:25 +01:00
Christian Richter 0372869b8b refactor remaining code from urfave/cli
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
2025-12-15 16:40:27 +01:00
Christian Richter 7be33b0607 refactor interims DefaultAppCobra to DefaultApp
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
2025-12-15 16:40:26 +01:00
Christian Richter 7e1ab4f34f migrate thumbnails from urfave/cli to spf13/cobra
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
2025-12-15 16:40:26 +01:00
Jörn Friedrich Dreyer 10913ca00a Merge pull request #1918 from opencloud-eu/otlp-tracing
update otlp tracing
2025-11-27 12:57:26 +01:00
Jörn Friedrich Dreyer a3ef7f6d79 update otlp tracing
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-11-27 12:28:15 +01:00
Ralf Haferkamp 3badc66d4a fix: adapt to new function signatures
To allow to bump to latest kovidgoyal/imaging release
2025-11-26 14:46:30 +01:00
Michael Barz 3b27d8f580 change: use 404 as status when thumbnail can not be fetched (#1582) 2025-09-30 20:40:31 +02:00
Roman Perekhod c597dfb917 set default timeouts and clean up 2025-09-12 12:18:47 +02:00
Roman Perekhod 9a3fc08dd4 to separate controll ower the http and grpc driven services 2025-09-12 12:18:47 +02:00
Juan Pablo Villafáñez 9e1b80a1be feat: use runners to startup the services 2025-09-12 12:18:47 +02:00
André Duffeck 683b979bdd Remove unused code 2025-07-22 10:42:46 +02:00
Christian RichterandAndré Duffeck 49ab88e980 Add signed-url handling to thumbnail service
Co-authored-by: André Duffeck <a.duffeck@opencloud.eu>

Signed-off-by: Christian Richter <c.richter@opencloud.eu>
2025-07-22 08:51:16 +02:00
Michael Barz 887257fa38 feat: add webp format (#869) 2025-05-22 09:19:50 +02:00
Ralf Haferkamp 96684df32d Adjust to new tablewriter release 2025-05-19 19:26:38 +02:00
Ralf Haferkamp c46e0c4b6b Fix build with go 1.24
Go 1.24 does some stricter checks now on arguments to functions
accepting format strings.
This commit fixes a couple of "non-constant format string in call
to ..." errors when running the unit tests.
2025-03-10 10:43:34 +01:00
Ralf Haferkamp 8e1f68f315 Reset 'introductionVersion" struct tag to 1.0.0 2025-02-24 11:40:33 +01:00
Jannik Stehle 64afb387a2 chore: replace branded ggs test files 2025-01-28 09:38:22 +01:00
Jannik Stehle fac4ebbf0f chore: remove or change branded test files in thumbnail service 2025-01-27 15:12:12 +01:00
André Duffeck e8d35e1280 Use the opencloud reva from now on 2025-01-21 11:16:38 +01:00
Jörn Friedrich Dreyer 78c22c0b84 thumbnails
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-17 12:03:15 +01:00
Ralf Haferkamp 213e9663a9 Rename go-micro services 2025-01-16 09:45:46 +01:00
André Duffeck 8c8cdd9310 Adapt protobuf naming 2025-01-15 11:04:32 +01:00
Jörn Friedrich Dreyer 318ca21645 metrics, log and supervisor
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-14 16:09:54 +01:00
Jörn Friedrich Dreyer 5aa5ab843a ociscfg -> occfg
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-14 12:44:00 +01:00
Jörn Friedrich Dreyer b07b5a1149 use plain pkg module
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-13 16:42:19 +01:00
Jörn Friedrich Dreyer a46fd132bd use OC_ env prefix
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-13 16:11:11 +01:00