Skip to content

Commit 50e903b

Browse files
martinuygnu-andrew
authored andcommitted
8305312: Enhanced path handling
Reviewed-by: yan, andrew Backport-of: cb7cef2b85264c2bd2d00f1c0e5010969aa618d3
1 parent ec0818a commit 50e903b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jdk/src/solaris/classes/sun/nio/fs/UnixUriUtils.java

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

0 commit comments

Comments
 (0)