Skip to content

Commit

Permalink
Fix duplicate dir handling in untar transform (#61917) (#61933)
Browse files Browse the repository at this point in the history
  • Loading branch information
breskeby authored Sep 3, 2020
1 parent 3d23dcd commit 9d4e1f1
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

public abstract class SymbolicLinkPreservingUntarTransform implements UnpackTransform {

private static final Path CURRENT_DIR_PATH = Paths.get(".");

public void unpack(File tarFile, File targetDir) throws IOException {
Logging.getLogger(SymbolicLinkPreservingUntarTransform.class)
.info("Unpacking " + tarFile.getName() + " using " + SymbolicLinkPreservingUntarTransform.class.getSimpleName() + ".");
Expand All @@ -47,7 +49,7 @@ public void unpack(File tarFile, File targetDir) throws IOException {
TarArchiveEntry entry = tar.getNextTarEntry();
while (entry != null) {
final Path relativePath = pathModifier.apply(entry.getName());
if (relativePath == null) {
if (relativePath == null || relativePath.getFileName().equals(CURRENT_DIR_PATH)) {
entry = tar.getNextTarEntry();
continue;
}
Expand Down

0 comments on commit 9d4e1f1

Please sign in to comment.