summaryrefslogtreecommitdiff
path: root/src/backends/webdav/WebDAVSource.cpp
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2012-02-20 17:04:42 +0100
committerPatrick Ohly <patrick.ohly@intel.com>2012-02-23 13:04:28 +0000
commit28f98fab2f7dda387e703107b093a95a79f5a087 (patch)
tree05e8fc4861a392f5cee2749f6d88df71799ba5d5 /src/backends/webdav/WebDAVSource.cpp
parent93b47ace6795c3415bd3c36eb5d63c4e8d35c2d9 (diff)
WebDAV: better path normalization (Radicale)
Radicale sends <href> values with more than one slash as separator: <href>/public_user/calendar/calendar_1//20060406T211449Z-4562-727-1-63@gollum.ics</href> SyncEvolution then only stripped the part up and including ".../calendar_1/" and used the rest as ID, which later failed because the leading slash in "/20060406T211449Z-4562-727-1-63@gollum.ics" led to requests for an item in the root of the server.
Diffstat (limited to 'src/backends/webdav/WebDAVSource.cpp')
-rw-r--r--src/backends/webdav/WebDAVSource.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backends/webdav/WebDAVSource.cpp b/src/backends/webdav/WebDAVSource.cpp
index 403b192b..56b6c8d9 100644
--- a/src/backends/webdav/WebDAVSource.cpp
+++ b/src/backends/webdav/WebDAVSource.cpp
@@ -1161,11 +1161,15 @@ void WebDAVSource::listAllItemsCallback(const Neon::URI &uri,
std::string WebDAVSource::path2luid(const std::string &path)
{
- if (boost::starts_with(path, m_calendar.m_path)) {
- return Neon::URI::unescape(path.substr(m_calendar.m_path.size()));
+ // m_calendar.m_path is normalized, path is not.
+ // Before comparing, normalize it.
+ std::string res = Neon::URI::normalizePath(path, false);
+ if (boost::starts_with(res, m_calendar.m_path)) {
+ res = Neon::URI::unescape(res.substr(m_calendar.m_path.size()));
} else {
- return path;
+ // keep full, absolute path as LUID
}
+ return res;
}
std::string WebDAVSource::luid2path(const std::string &luid)