Skip to content

Commit 1d38084

Browse files
martinuyRealCLanger
authored andcommitted
8305312: Enhanced path handling
Reviewed-by: yan Backport-of: cb7cef2b85264c2bd2d00f1c0e5010969aa618d3
1 parent 37fbcf6 commit 1d38084

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ static Path fromUri(UnixFileSystem fs, URI uri) {
7575
int pos = 0;
7676
while (pos < len) {
7777
char c = p.charAt(pos++);
78-
if ((c == '/') && (pos < len) && (p.charAt(pos) == '/')) {
79-
// skip redundant slashes
80-
continue;
81-
}
8278
byte b;
8379
if (c == '%') {
8480
assert (pos+2) <= len;
@@ -92,6 +88,10 @@ static Path fromUri(UnixFileSystem fs, URI uri) {
9288
throw new IllegalArgumentException("Bad escape");
9389
b = (byte)c;
9490
}
91+
if (b == '/' && rlen > 0 && result[rlen-1] == '/') {
92+
// skip redundant slashes
93+
continue;
94+
}
9595
result[rlen++] = b;
9696
}
9797
if (rlen != result.length)

0 commit comments

Comments
 (0)