mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-09-12 13:49:13 -04:00
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.
22 lines
353 B
Go
22 lines
353 B
Go
//go:build enable_vips
|
|
|
|
package preprocessor
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/davidbyttow/govips/v2/vips"
|
|
)
|
|
|
|
func init() {
|
|
vips.LoggingSettings(nil, vips.LogLevelError)
|
|
}
|
|
|
|
type ImageDecoder struct{}
|
|
|
|
func (v ImageDecoder) Convert(_ context.Context, r io.Reader) (interface{}, error) {
|
|
img, err := vips.NewImageFromReader(r)
|
|
return img, err
|
|
}
|