Skip to content

Commit

Permalink
Merge pull request icecc#403 from hferreiro/master
Browse files Browse the repository at this point in the history
Fix get_absfilename()
  • Loading branch information
llunak authored Jun 29, 2019
2 parents 05cfcdd + 60c580d commit 07bbfd1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions client/remote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,17 @@ get_absfilename(const string &_file)
file = _file;
}

string::size_type idx = file.find("/..");
string dots = "/../";
string::size_type idx = file.find(dots);

while (idx != string::npos) {
file.replace(idx, 3, "/");
idx = file.find("/..");
if (idx == 0) {
file.replace(0, dots.length(), "/");
} else {
string::size_type slash = file.find_last_of('/', idx - 1);
file.replace(slash, idx-slash+dots.length(), "/");
}
idx = file.find(dots);
}

idx = file.find("/./");
Expand Down

0 comments on commit 07bbfd1

Please sign in to comment.