Trim multiple leading slashes in NestedLocation

See gh-37668
This commit is contained in:
Andy Wilkinson 2023-10-20 11:51:42 +01:00
parent 88bf3dfba2
commit d13d38a141
1 changed files with 4 additions and 2 deletions

View File

@ -102,8 +102,10 @@ public record NestedLocation(Path path, String nestedEntryName) {
private static NestedLocation create(int index, String location) {
String locationPath = location.substring(0, index);
if (isWindows() && locationPath.startsWith("/")) {
locationPath = locationPath.substring(1, locationPath.length());
if (isWindows()) {
while (locationPath.startsWith("/")) {
locationPath = locationPath.substring(1, locationPath.length());
}
}
String nestedEntryName = location.substring(index + 2);
return new NestedLocation((!locationPath.isEmpty()) ? Path.of(locationPath) : null, nestedEntryName);