Skip to content

Commit 496458f

Browse files
committed
Merge pull request etr#91 from pnxs/master
FIX: logic error in refactoring
2 parents 195d2da + 7353e9f commit 496458f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/details/http_endpoint.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,15 @@ http_endpoint::http_endpoint
8080

8181
if((parts[i] != "") && (parts[i][0] != '{'))
8282
{
83-
this->url_modded = (first ? "" : "/") + (parts[i][0] == '^' ? "" : this->url_modded) + parts[i];
84-
first = false;
83+
if(first)
84+
{
85+
this->url_modded = (parts[i][0] == '^' ? "" : this->url_modded) + parts[i];
86+
first = false;
87+
}
88+
else
89+
{
90+
this->url_modded += "/" + parts[i];
91+
}
8592
this->url_pieces.push_back(parts[i]);
8693

8794
continue;
@@ -91,7 +98,7 @@ http_endpoint::http_endpoint
9198
throw bad_http_endpoint();
9299

93100
std::string::size_type bar = parts[i].find_first_of('|');
94-
this->url_pars.push_back(parts[i].substr(1, bar != string::npos ? bar - 1 : parts[i].size() - bar - 2));
101+
this->url_pars.push_back(parts[i].substr(1, bar != string::npos ? bar - 1 : parts[i].size() - 2));
95102
this->url_modded += (first ? "" : "/") + (bar != string::npos ? parts[i].substr(bar + 1, parts[i].size() - bar - 2) : "([^\\/]+)");
96103

97104
first = false;

0 commit comments

Comments
 (0)