-
Notifications
You must be signed in to change notification settings - Fork 972
Commit
…ashes in path component
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,8 +147,20 @@ public static URI rewriteURI( | |
if (dropFragment) { | ||
uribuilder.setFragment(null); | ||
} | ||
if (TextUtils.isEmpty(uribuilder.getPath())) { | ||
final String path = uribuilder.getPath(); | ||
if (TextUtils.isEmpty(path)) { | ||
uribuilder.setPath("/"); | ||
} else { | ||
final StringBuilder buf = new StringBuilder(path.length()); | ||
boolean foundSlash = false; | ||
for (int i = 0; i < path.length(); i++) { | ||
final char ch = path.charAt(i); | ||
if (ch != '/' || !foundSlash) { | ||
buf.append(ch); | ||
} | ||
foundSlash = ch == '/'; | ||
} | ||
uribuilder.setPath(buf.toString()); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gjesse
|
||
} | ||
return uribuilder.build(); | ||
} | ||
|
Calling setPath here updates encodedPath to null and url encoded characters are removed from the path when uribuilder.build() is called in next line.