diff options
author | Michi Henning <michi@zeroc.com> | 2005-02-21 01:28:39 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-02-21 01:28:39 +0000 |
commit | 216eb6b4e91a6a2680562df65c99e8562679c92e (patch) | |
tree | 85afe8af7a21f50375fb68d0e716910c43bc15d4 /cpp/src/IcePatch2/Util.cpp | |
parent | Added check to server to disallow absolute paths and paths containing "..". (diff) | |
download | ice-216eb6b4e91a6a2680562df65c99e8562679c92e.tar.bz2 ice-216eb6b4e91a6a2680562df65c99e8562679c92e.tar.xz ice-216eb6b4e91a6a2680562df65c99e8562679c92e.zip |
Fixed bug in getSuffix: it was returning "c/d" for a path such as
"a/b.c/d".
Diffstat (limited to 'cpp/src/IcePatch2/Util.cpp')
-rw-r--r-- | cpp/src/IcePatch2/Util.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp index 49da0c2edba..f2ebc03a07d 100644 --- a/cpp/src/IcePatch2/Util.cpp +++ b/cpp/src/IcePatch2/Util.cpp @@ -280,14 +280,16 @@ IcePatch2::getSuffix(const string& pa) { const string path = simplify(pa); - string::size_type pos = path.rfind('.'); - if(pos == string::npos) + string::size_type dotPos = path.rfind('.'); + string::size_type slashPos = path.rfind('/'); + + if(dotPos == string::npos || slashPos != string::npos && slashPos > dotPos) { return string(); } else { - return path.substr(pos + 1); + return path.substr(dotPos + 1); } } |