As you can see, one of the paths is escaped and the other isn't.
I've a feeling the difference could be purely academic - but I figure it's worth noting.
brianWed 1 Jul 2020
Ticket promoted to #2803 and assigned to brian
That is a little tricky, probably what you are suggesting is the correct behavior. Need to really dig in to think about it though.
If we did anything then we would call sys::Uri.escapeToken using sectionPath on the string. But changing it now might break code that might have been including special chars (even if that was incorrect).
SlimerDude Tue 30 Jun 2020
I believe this to be a bug / edge case in the Uri.plusName(...) method...
If I want to add
foo?baras a URI path segment I can do this:uri := `/root/`.plusName("foo?bar") echo(uri) // --> /root/foo?bar - would expect "/root/foo\?bar" echo(uri.encode) // --> /root/foo%3FbarThe
.toStr()method doesn't give quite what I'd expect, but at least the.encode()method does.But should I try to encode
foo/barI get:uri := `/root/`.plusName("foo/bar") echo(uri) // --> /root/foo/bar - would expect "/root/foo\/bar" echo(uri.encode) // --> /root/foo/bar - would expect "/root/foo%2Fbar"For all intents and purposes of adding a single path name, I don't think
.plusName()quite works as intended.Looking for a work-around, I'm finding some inconsistent behaviour and I'm not sure which is correct...
uri1 := `/root/foo:bar/wotever` uri2 := `/root/`.plusName(Uri.escapeToken("foo:bar", Uri.sectionPath), true).plusName("wotever") echo(uri1.path) // --> [root, foo:bar, wotever] echo(uri2.path) // --> [root, foo\:bar, wotever]As you can see, one of the paths is escaped and the other isn't.
I've a feeling the difference could be purely academic - but I figure it's worth noting.
brian Wed 1 Jul 2020
Ticket promoted to #2803 and assigned to brian
That is a little tricky, probably what you are suggesting is the correct behavior. Need to really dig in to think about it though.
If we did anything then we would call
sys::Uri.escapeTokenusingsectionPathon the string. But changing it now might break code that might have been including special chars (even if that was incorrect).