dschmidt opened a new pull request, #3039: URL: https://github.com/apache/tika/pull/3039
When parsing through tika-pipes (tika-server /unpack and /unpack/all, /async, /pipes), a caller can steer parser selection by supplying a filename, but supplying the correct `Content-Type` header alone does not work. Example: NEF is TIFF-based with no content magic; `image/x-raw-nikon` is a `*.nef` glob plus `sub-class-of image/tiff`. By data alone a NEF detects as `image/tiff` (→ TiffParser); only the filename yields `image/x-raw-nikon`. A client streaming a NEF with `Content-Type: image/x-raw-nikon` but no filename still gets TiffParser. Root cause: `PipesWorker.parseFromTuple` builds a fresh `Metadata` for fetch/detection (deliberately isolated from the caller's tuple metadata) and carries only `RESOURCE_NAME_KEY` across that boundary. The caller's `Content-Type`, which `TikaResource.fillMetadata` does set, is dropped before detection. Core detection would honor it: `MimeTypes.detect` applies a `Content-Type` hint via `applyHint`, keeping it when it equals or specializes the magic-detected type. This change carries `HttpHeaders.CONTENT_TYPE` across the boundary alongside the resource name, as a soft hint. **Security:** only the soft hint is carried, deliberately **not** `CONTENT_TYPE_USER_OVERRIDE`/`CONTENT_TYPE_PARSER_OVERRIDE`. `applyHint` constrains the hint to types that equal or specialize the magic-detected type, so a caller can refine within the hierarchy (`image/tiff` → `image/x-raw-nikon`) but cannot force an unrelated type. This grants no more routing power than the already-carried filename, and detection overwrites `HttpHeaders.CONTENT_TYPE` with the detected type before parsing, so no parser sees an unvalidated caller value. Carrying an override key would instead let a caller bypass detection unconditionally. This softens the worker's deliberate metadata isolation for two fields; feedback welcome on whether the soft-hint scope is the right contract. Unit test covers the carry: resource name and `Content-Type` carried, override key never carried, null/blank no-ops. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
