File tree 2 files changed +15
-1
lines changed
main/java/org/readium/r2/shared/util
test/java/org/readium/r2/shared/util
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,11 @@ public sealed class Url : Parcelable {
182
182
uri.buildUpon()
183
183
.apply {
184
184
path?.let {
185
- path(File (it).normalize().path)
185
+ var normalizedPath = File (it).normalize().path
186
+ if (it.endsWith(" /" )) {
187
+ normalizedPath + = " /"
188
+ }
189
+ path(normalizedPath)
186
190
}
187
191
188
192
if (this @Url is AbsoluteUrl ) {
Original file line number Diff line number Diff line change @@ -432,6 +432,16 @@ class UrlTest {
432
432
Url (" foo/./bar/../../../baz" )!! .normalize().toString()
433
433
)
434
434
435
+ // Trailing slash is kept.
436
+ assertEquals(
437
+ " http://example.com/foo/" ,
438
+ Url (" http://example.com/foo/" )!! .normalize().toString()
439
+ )
440
+ assertEquals(
441
+ " foo/" ,
442
+ Url (" foo/" )!! .normalize().toString()
443
+ )
444
+
435
445
// The other components are left as-is.
436
446
assertEquals(
437
447
" http://user:password@example.com:443/foo?b=b&a=a#fragment" ,
You can’t perform that action at this time.
0 commit comments