rikkimax / alphaPhobos

Assume License: Boost
11 stars 1 forks source link

uri: 'expand' erroneously expands "~user" #6

Closed dhasenan closed 8 years ago

dhasenan commented 8 years ago

The path "~person" expands to the home directory of the user named "person".

auto url = URIAddress("file://~foo/bar");
auto myHome = URIAddress("file:///home/dhasenan");
auto pwd = URIAddress("file:///tmp");
writeln(url.expand(myHome, pwd));

That should print file://~foo/bar -- there's not enough information here to expand ~foo. It actually prints file:///home/dhasenan/foo/bar -- pretending that there was a path separator after the tilde.

rikkimax commented 8 years ago

When you call expand, you are saying that you want an absolute URI address. However the usage of ~foo expanding is indeed incorrect. It should be checking if there is a / or \ after it.