Skip to content

TIKA-4705 -- resourceName of tar file in nested tarball should not contain tarball's parent directories#2750

Open
iachimoe wants to merge 1 commit intoapache:mainfrom
iachimoe:feat/TIKA-4705_tarball
Open

TIKA-4705 -- resourceName of tar file in nested tarball should not contain tarball's parent directories#2750
iachimoe wants to merge 1 commit intoapache:mainfrom
iachimoe:feat/TIKA-4705_tarball

Conversation

@iachimoe
Copy link
Copy Markdown

@iachimoe iachimoe commented Apr 7, 2026

…rent directories of its parent gzip file, plus fixing typo where '.' was missing from gz extension

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!

…rent directories of its parent gzip file, plus fixing typo where '.' was missing from gz extension
@iachimoe
Copy link
Copy Markdown
Author

iachimoe commented Apr 7, 2026

For some reason I have had some problems running maven locally against main, so I'm not sure at the time of writing if all tests/style checks pass

@THausherr THausherr requested a review from Copilot April 7, 2026 17:59
@THausherr THausherr changed the title TIKA-4705 -- resourceName of nested tarball should not contain the pa… TIKA-4705 -- resourceName of tar file in nested tarball should not contain tarball's parent directories Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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-4705 by ensuring that the derived resourceName for a decompressed nested tarball does not inherit parent-directory components from the enclosing gzip entry, and it fixes a .gz extension check typo.

Changes:

  • Strip parent path components from RESOURCE_NAME_KEY before deriving the uncompressed name in CompressorParser.
  • Fix the extension check from endsWith("gz") to endsWith(".gz").
  • Add a regression test and a new nested tar test fixture to validate RESOURCE_NAME_KEY, INTERNAL_PATH, and EMBEDDED_RESOURCE_PATH behavior.

Reviewed changes

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

File Description
.../RecursiveParserWrapperTest.java Adds testNestedTarball() to validate nested tar-in-gz resource naming and embedded paths.
.../test-nested-tarball.tar Adds a new test fixture containing a nested .tgz to reproduce the original issue.
.../CompressorParser.java Normalizes parent RESOURCE_NAME_KEY to a basename before mapping .tgz/.gz/... to the uncompressed name.

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

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