Skip to content

TIKA-4752 - #2869

Merged
tballison merged 2 commits into
mainfrom
TIKA-4752
Jun 5, 2026
Merged

TIKA-4752#2869
tballison merged 2 commits into
mainfrom
TIKA-4752

Conversation

@tballison

Copy link
Copy Markdown
Contributor

Thanks for your contribution to Apache Tika! Your help is appreciated!

Before opening the pull request, please verify that

  • there is an open issue on the Tika issue tracker which describes the problem or the improvement. We cannot accept pull requests without an issue because the change wouldn't be listed in the release notes.
  • the issue ID (TIKA-XXXX)
    • is referenced in the title of the pull request
    • and placed in front of your commit messages surrounded by square brackets ([TIKA-XXXX] Issue or pull request title)
  • commits are squashed into a single one (or few commits for larger changes)
  • Tika is successfully built and unit tests pass by running ./mvnw clean test
  • there should be no conflicts when merging the pull request branch into the recent main branch. If there are conflicts, please try to rebase the pull request branch on top of a freshly pulled main branch
  • if you add new module that downstream users will depend upon add it to relevant group in tika-bom/pom.xml.

We will be able to faster integrate your pull request if these conditions are met. If you have any questions how to fix your problem or about using Tika in general, please sign up for the Tika mailing list. Thanks!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses TIKA-4752 by improving how ZipParser determines ZIP entry names when UTF-8 is indicated by ZIP metadata. It adds focused tests to ensure ZIP entry-name decoding honors both the EFS (UTF-8) flag and the Unicode path extra field, and extends MetadataCharsetDetector so charset declarations can be sourced from CONTENT_TYPE_HINT.

Changes:

  • Update ZipParser to trust commons-compress’s CRC-validated Unicode extra-field names and to pass an EFS-derived UTF-8 hint into the encoding-detector chain when charset detection is enabled.
  • Extend MetadataCharsetDetector to consult TikaCoreProperties.CONTENT_TYPE_HINT (between Metadata.CONTENT_TYPE and Metadata.CONTENT_ENCODING).
  • Add unit tests covering the new ZIP entry-name behavior and the new MetadataCharsetDetector precedence rules.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tika-parsers/.../ZipEntryNameEncodingTest.java New tests validating ZIP entry-name decoding via EFS flag hinting and Unicode extra-field handling.
tika-parsers/.../ZipParser.java Entry-name detection changes to honor Unicode extra fields and use EFS as a UTF-8 hint for charset detection.
tika-core/src/test/.../MetadataCharsetDetectorTest.java New tests for CONTENT_TYPE_HINT handling and precedence vs CONTENT_TYPE and CONTENT_ENCODING.
tika-core/src/main/.../MetadataCharsetDetector.java Adds CONTENT_TYPE_HINT as an additional metadata source for declarative charset detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tballison
tballison merged commit 88a6fc5 into main Jun 5, 2026
6 checks passed
@tballison
tballison deleted the TIKA-4752 branch September 3, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants