Trim multiple leading slashes in NestedLocation
See gh-37668
This commit is contained in:
parent
88bf3dfba2
commit
d13d38a141
|
@ -102,8 +102,10 @@ public record NestedLocation(Path path, String nestedEntryName) {
|
||||||
|
|
||||||
private static NestedLocation create(int index, String location) {
|
private static NestedLocation create(int index, String location) {
|
||||||
String locationPath = location.substring(0, index);
|
String locationPath = location.substring(0, index);
|
||||||
if (isWindows() && locationPath.startsWith("/")) {
|
if (isWindows()) {
|
||||||
locationPath = locationPath.substring(1, locationPath.length());
|
while (locationPath.startsWith("/")) {
|
||||||
|
locationPath = locationPath.substring(1, locationPath.length());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String nestedEntryName = location.substring(index + 2);
|
String nestedEntryName = location.substring(index + 2);
|
||||||
return new NestedLocation((!locationPath.isEmpty()) ? Path.of(locationPath) : null, nestedEntryName);
|
return new NestedLocation((!locationPath.isEmpty()) ? Path.of(locationPath) : null, nestedEntryName);
|
||||||
|
|
Loading…
Reference in New Issue