mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-26 14:47:44 +00:00
Possible fix for #49
- Radicale incorrectly unquotes URLs
- Older versions of radicale are so buggy they fail to look up items
with url quotes in them.
- ownCloud/SabreDAV follows the rebustness principle such that it
takes anything, but returns properly encoded URLs.
Conclusion: Send broken, unquoted URLs, because both sides seem to be
happy with them. As wrong as it might seem, it works.
This commit is contained in:
parent
89063c5096
commit
b5df8a4514
2 changed files with 7 additions and 1 deletions
|
|
@ -117,9 +117,10 @@ class DavStorage(Storage):
|
||||||
schema.'''
|
schema.'''
|
||||||
x = utils.urlparse.urljoin(self.url, href)
|
x = utils.urlparse.urljoin(self.url, href)
|
||||||
assert x.startswith(self.url)
|
assert x.startswith(self.url)
|
||||||
return utils.urlparse.urlsplit(x).path
|
return utils.urlunquote_plus(utils.urlparse.urlsplit(x).path)
|
||||||
|
|
||||||
def _get_href(self, uid):
|
def _get_href(self, uid):
|
||||||
|
uid = utils.urlunquote_plus(uid)
|
||||||
return self._normalize_href(super(DavStorage, self)._get_href(uid))
|
return self._normalize_href(super(DavStorage, self)._get_href(uid))
|
||||||
|
|
||||||
def _request(self, method, path, data=None, headers=None):
|
def _request(self, method, path, data=None, headers=None):
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,16 @@ PY2 = sys.version_info[0] == 2
|
||||||
|
|
||||||
if PY2:
|
if PY2:
|
||||||
import urlparse
|
import urlparse
|
||||||
|
from urllib import \
|
||||||
|
quote_plus as urlquote_plus, \
|
||||||
|
unquote_plus as urlunquote_plus
|
||||||
text_type = unicode # flake8: noqa
|
text_type = unicode # flake8: noqa
|
||||||
iteritems = lambda x: x.iteritems()
|
iteritems = lambda x: x.iteritems()
|
||||||
itervalues = lambda x: x.itervalues()
|
itervalues = lambda x: x.itervalues()
|
||||||
else:
|
else:
|
||||||
import urllib.parse as urlparse
|
import urllib.parse as urlparse
|
||||||
|
urlquote_plus = urlparse.quote_plus
|
||||||
|
urlunquote_plus = urlparse.unquote_plus
|
||||||
text_type = str
|
text_type = str
|
||||||
iteritems = lambda x: x.items()
|
iteritems = lambda x: x.items()
|
||||||
itervalues = lambda x: x.values()
|
itervalues = lambda x: x.values()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue