[
https://issues.apache.org/jira/browse/TIKA-5031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18138062#comment-18138062
]
ASF GitHub Bot commented on TIKA-5031:
--------------------------------------
dschmidt opened a new pull request, #3529:
URL: https://github.com/apache/tika/pull/3529
`.3mf` files are detected as
`application/vnd.ms-package.3dmanufacturing-3dmodel+xml` (TIKA-4224). Without a
declared supertype, the `+xml` suffix made that a sub-type of
`application/xml`, so XMLParser received the zip package and failed;
`/unpack/preset/thumbnail` answered 422.
- `tika-mimetypes.xml`: the type is declared a sub-type of
`application/zip`, which takes precedence over the suffix rule, so ZipParser
opens the package.
- `ZipParser`: the type is added to the zip specializations whose content
type it keeps, instead of overwriting it with `application/zip`.
- `OPCPackageDetector`: `[Content_Types].xml` maps the 3MF model content
type, so the streaming zip detector returns 3MF instead of `x-tika-ooxml`.
`TestContainerAwareDetector.test3MF` only checks the streaming detector for zip
sub-types, which is why this did not show before.
Test: `test3mf.3mf` keeps its type, has no container exception and its parts
come out as embedded documents. Also checked against the 3MF Consortium's
sample files: 37 of 40 answered 422 before and parse now; three were detected
as plain zip before and are now detected as 3MF. Marking
`Metadata/thumbnail.png` as the THUMBNAIL is TIKA-5032.
Open question: the `+xml` type names the model part inside the package; IANA
registers the package itself as `model/3mf`. Renaming would change the detected
type for existing users, so this PR keeps the name.
https://issues.apache.org/jira/browse/TIKA-5031
> 3MF packages are parsed as XML and fail
> ---------------------------------------
>
> Key: TIKA-5031
> URL: https://issues.apache.org/jira/browse/TIKA-5031
> Project: Tika
> Issue Type: Bug
> Components: parser
> Reporter: Dominik Schmidt
> Priority: Major
>
> {{.3mf}} files are detected as
> {{application/vnd.ms-package.3dmanufacturing-3dmodel+xml}} (TIKA-4224). The
> {{+xml}} suffix makes that a sub-type of {{application/xml}}, so XMLParser
> receives the zip package and fails with "XML parse error": {{/unpack}}
> answers 422, {{/rmeta}} records a container exception.
> The {{+xml}} type names the model part inside the package; the package itself
> is registered with IANA as {{model/3mf}}. Detecting the package as
> {{model/3mf}} (a zip sub-type) would let a package parser open it, and its
> {{Metadata/thumbnail.png}} could be emitted as the thumbnail.
> Reproduce with {{test3mf.3mf}} from the integration-test documents (that file
> has no {{Metadata/thumbnail.png}}, so a fixture with one would be needed for
> the thumbnail part).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)