CloudPolis / webdav-client-cpp

:cloud: C++ WebDAV Client provides easy and convenient to work with WebDAV-servers.
http://cloudpolis.github.io/webdav-client-cpp/
Other
120 stars 52 forks source link

Wrong behavior if path ends with slash? #46

Closed horde3d closed 6 years ago

horde3d commented 6 years ago

If a path ends with a slash the parent() method probably does not return what is expected. Example: Path("test/some_path/").parent().path() will return "test/some_path/".

By changing https://github.com/CloudPolis/webdav-client-cpp/blob/3af8c9c7cec55be201c93f6bd4720818db6e7f50/sources/urn.cpp#L140

to auto last_separate_position = m_path.rfind(Path::separate, m_path.length() - 2); it should be ok I guess.

rusdevops commented 6 years ago

https://github.com/CloudPolis/webdav-client-cpp/blob/3af8c9c7cec55be201c93f6bd4720818db6e7f50/sources/urn.cpp#L47

rusdevops commented 6 years ago

Thank you for your code review 👍