File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
javalib/src/main/scala/java/net
test-suite/src/test/scala/org/scalajs/testsuite/javalib Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -493,8 +493,8 @@ object URI {
493
493
val absoluteURI = scheme+ " :(?:(" + hier_part+ " )|(" + opaque_part+ " ))" /* 2CAPT*/
494
494
495
495
// relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
496
- val relativeURI = /* 2CAPT */
497
- " (?:" + net_path+ " |(" + abs_path+ " )|(" + rel_path+ " ))(?:\\ ?" + query+ " )?"
496
+ val relativeURI = /* 3CAPT */
497
+ " (( ?:" + net_path+ " |(" + abs_path+ " )|(" + rel_path+ " ))(?:\\ ?" + query+ " )?) "
498
498
499
499
// URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
500
500
val uriRef = " ^(?:" + absoluteURI+ " |" + relativeURI+ " )(?:#" + fragment+ " )?$"
@@ -513,8 +513,8 @@ object URI {
513
513
final val AbsAbsPath = AbsNetPath + 1
514
514
final val AbsQuery = AbsAbsPath + 1
515
515
final val AbsOpaquePart = AbsQuery + 1
516
- final val RelSchemeSpecificPart = 0 // It's the whole string
517
- final val RelAuthority = AbsOpaquePart + 1
516
+ final val RelSchemeSpecificPart = AbsOpaquePart + 1 // Everything but the fragment
517
+ final val RelAuthority = RelSchemeSpecificPart + 1
518
518
final val RelUserInfo = RelAuthority + 1
519
519
final val RelHost = RelUserInfo + 1
520
520
final val RelPort = RelHost + 1
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ object URITest extends JasmineTest {
100
100
expectURI(new URI (" docs/guide/collections/designfaq.html#28" ), false , false )(
101
101
path = " docs/guide/collections/designfaq.html" ,
102
102
fragment = " 28" ,
103
- schemeSpecificPart = " docs/guide/collections/designfaq.html#28 "
103
+ schemeSpecificPart = " docs/guide/collections/designfaq.html"
104
104
)()
105
105
expectURI(new URI (" ../../../demo/jfc/SwingSet2/src/SwingSet2.java" ), false , false )(
106
106
path = " ../../../demo/jfc/SwingSet2/src/SwingSet2.java" ,
@@ -142,7 +142,16 @@ object URITest extends JasmineTest {
142
142
expectURI(new URI (" #foo" ), false , false )(
143
143
fragment = " foo" ,
144
144
path = " " ,
145
- schemeSpecificPart = " #foo"
145
+ schemeSpecificPart = " "
146
+ )()
147
+ }
148
+
149
+ it(" should parse relative URIs with query and fragment" ) {
150
+ expectURI(new URI (" ?query=1#foo" ), false , false )(
151
+ query = " query=1" ,
152
+ fragment = " foo" ,
153
+ path = " " ,
154
+ schemeSpecificPart = " ?query=1"
45FE
;
146
155
)()
147
156
}
148
157
You can’t perform that action at this time.
0 commit comments