Skip to content

Commit 9665dc4

Browse files
committed
Added path normalization for duplicate check
1 parent 25b348a commit 9665dc4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ else if ( o instanceof PlexusIoResourceCollection )
521521
}
522522
}
523523

524-
if ( nextEntry != null && seenEntries.contains( nextEntry.getName() ) )
524+
if ( nextEntry != null && seenEntries.contains( normalizedForDuplicateCheck(nextEntry ) ))
525525
{
526526
final String path = nextEntry.getName();
527527

@@ -569,7 +569,7 @@ public ArchiveEntry next()
569569
final ArchiveEntry next = nextEntry;
570570
nextEntry = null;
571571

572-
seenEntries.add( next.getName() );
572+
seenEntries.add( normalizedForDuplicateCheck(next) );
573573

574574
return next;
575575
}
@@ -578,7 +578,13 @@ public void remove()
578578
{
579579
throw new UnsupportedOperationException( "Does not support iterator" );
580580
}
581+
582+
private String normalizedForDuplicateCheck(ArchiveEntry entry){
583+
return entry.getName().replace( '\\', '/' );
584+
}
585+
581586
};
587+
582588
}
583589

584590
public Map<String, ArchiveEntry> getFiles()

0 commit comments

Comments
 (0)