You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you create a URI object without a path (e.g. only with query string or fragment identifier), directory and file are not set to the current dir and file name.
If I read RFC 3986 correctly it should fall back to the current URI.
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/35995455-relative-uri-has-wrong-directory-and-file-values?utm_campaign=plugin&utm_content=tracker%2F22069&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F22069&utm_medium=issues&utm_source=github).
The text was updated successfully, but these errors were encountered:
I think this is intended since you would have to merge data otherwise:
// window.location.href = 'https://foo.bar/b/a.z?one=two&three=4'varuri1=newURI('?five=VI');// Should URI append another question mark here?varuri2=newURI('?three=III');// will that override or make an array or <...>?varuri3=newURI('&three=III');// ...
In your situation I would consider:
varbaseUrl='https://foo.bar/b/a.z?one=two&three=4';// window.location.hrefvarmyQueryString='?foo=bar&one=1';//--> [ removes ? and & from the very left ]varmyQueryStringObject=myQueryString.replace(/^[\?&]/,'').parseQueryString();varuri=newURI(baseUrl);// With that setData(..., true) you tell the URI instance to keep existing keys but allow to overwrite their values.uri.setData(myQueryStringObject,true);alert(uri.toString());// https://foo.bar/b/a.z?one=1&three=4&foo=bar
I know that I can work around this issue – that's what I'm currently doing – but I think it's desired to get get the correct behaviour from URI. That's what I would expect.
If the current status is really intended, I think it should be documented.
If you create a URI object without a path (e.g. only with query string or fragment identifier), directory and file are not set to the current dir and file name.
If I read RFC 3986 correctly it should fall back to the current URI.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/35995455-relative-uri-has-wrong-directory-and-file-values?utm_campaign=plugin&utm_content=tracker%2F22069&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F22069&utm_medium=issues&utm_source=github).The text was updated successfully, but these errors were encountered: