I believe this to be a bug in the Uri.fromStr(...) method...
Uri.fromStr(...)
Firstly, if I want to encode foo/bar as a URI segment I can do this:
foo/bar
uri := Uri.fromStr("foo\\/bar") echo(uri) // --> foo\/bar echo(uri.encode) // --> foo%2Fbar
But should I try to encode foo/ I get a ParseErr:
foo/
ParseErr
uri := Uri.fromStr("foo\\/") sys::ParseErr: Invalid Uri: 'foo\/' fan.sys.Uri.fromStr (Uri.java:41) fan.sys.Uri.fromStr (Uri.java:26)
Whereas I would expect foo/ to be legal and for this to work:
uri := Uri.fromStr("foo\\/") echo(uri) // --> foo\/ echo(uri.encode) // --> foo%2F
Definitely an obscure boundary condition to run across, but good catch. I pushed a fix for that problem.
Login or Signup to reply.
SlimerDude Mon 13 Oct 2014
I believe this to be a bug in the
Uri.fromStr(...)
method...Firstly, if I want to encode
foo/bar
as a URI segment I can do this:But should I try to encode
foo/
I get aParseErr
:Whereas I would expect
foo/
to be legal and for this to work:brian Mon 20 Oct 2014
Definitely an obscure boundary condition to run across, but good catch. I pushed a fix for that problem.