sysFatal (IndexError) with parseUri and the / operator #4959

Closed
dtkerr opened this Issue Oct 26, 2016 · 2 comments

Projects

None yet

2 participants

@dtkerr
dtkerr commented Oct 26, 2016

Using parseUri and / as shown in the example documentation:

let foo = parseUri("http://example.com/foo/bar") / "/baz"
assert foo.path == "/foo/bar/baz"

will cause a sysFatal because of improper indexing. The cause is simply that the ``/*(x: Uri, path: string) procedure assumes that `x.path` has a non-zero length. The `x.path` will have a len of 0 assuming it was only just created by `parseUri` as in the example.

I'm not sure if it's properly considered with parseUri and/or initUri not ensuring the path contains at least "/", or if it's an issue with / itself.

@dom96 dom96 added the Stdlib label Oct 26, 2016
@dom96
Member
dom96 commented Oct 26, 2016

Hrm, am I missing something? That code example works for me.

@dom96
Member
dom96 commented Oct 26, 2016

I guess you mean something like this:

import uri
let foo = parseUri("http://example.com") / "/baz"
assert foo.path == "/baz"
@dom96 dom96 added a commit that closed this issue Oct 26, 2016
@dom96 dom96 Fixes #4959. b2b2dcf
@dom96 dom96 closed this in b2b2dcf Oct 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment