Skip to content

Commit

Permalink
Deal with case-insensitive servers
Browse files Browse the repository at this point in the history
See Davmail/Outlook, #113
  • Loading branch information
untitaker committed Dec 8, 2014
1 parent 291edd7 commit 4c5f09e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions vdirsyncer/storage/dav.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class DavStorage(Storage):

def __init__(self, url, username='', password='', verify=True, auth=None,
useragent=USERAGENT, unsafe_href_chars='@',
verify_fingerprint=None, **kwargs):
verify_fingerprint=None, case_sensitive=True, **kwargs):
super(DavStorage, self).__init__(**kwargs)

url = url.rstrip('/') + '/'
Expand All @@ -256,6 +256,7 @@ def __init__(self, url, username='', password='', verify=True, auth=None,
self.session = DavSession(url, username, password, verify, auth,
useragent, verify_fingerprint)
self.unsafe_href_chars = unsafe_href_chars
self.case_sensitive = case_sensitive

# defined for _repr_attributes
self.username = username
Expand All @@ -276,8 +277,10 @@ def discover(cls, url, **kwargs):
s.displayname = c['displayname']
yield s

def _normalize_href(self, *args, **kwargs):
return _normalize_href(self.session.url, *args, **kwargs)
def _normalize_href(self, href, *args, **kwargs):
if not self.case_sensitive:
href = href.lower()
return _normalize_href(self.session.url, href, *args, **kwargs)

def _get_href(self, item):
href = item.ident
Expand Down

0 comments on commit 4c5f09e

Please sign in to comment.