NET-A-PORTER/scala-uri

Encoding seems broken

Closed this issue · 1 comments

howyp commented

I am having problems with v0.4.9. When I create a url starting with just a protocol and a hostname/port, and add a path and some query parameters, the URL generated has an extra slash and the query ? gets encoded:

scala> import com.netaporter.uri.dsl._
import com.netaporter.uri.dsl._

scala> val p = "http://localhost:1234"
p: String = http://localhost:1234

scala> p / "some/path/segments"
res0: com.netaporter.uri.Uri = http://localhost:1234/some/path/segments

scala> p / "some/path/segments" ? ("returnUrl" -> "http://localhost:1234/some/path/segments")
res1: com.netaporter.uri.Uri = http://localhost:1234//some/path/segments%3FreturnUrl=http://localhost:1234/some/path/segments

The examples from the README work correctly in the same REPL session:

scala> val uri = "http://theon.github.com/scala-uri" ? ("p1" -> "one") & ("p2" -> 2) & ("p3" -> true)
uri: com.netaporter.uri.Uri = http://theon.github.com/scala-uri?p1=one&p2=2&p3=true

scala> uri.toString
res4: String = http://theon.github.com/scala-uri?p1=one&p2=2&p3=true
theon commented

Thanks for raising this. I was able to reproduce on 0.4.9, but it seems fine on master. I think the publish of 0.4.9 got a bit messed up somehow. Sorry about that!

I have added a unit test and republished master as 0.4.10. Hopefully that should sort it, if not let me know.