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 3, 2014
1 parent 1efb00b commit 1eefb30
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 @@ -252,7 +252,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 @@ -263,6 +263,7 @@ def __init__(self, url, username='', password='', verify=True, auth=None,
useragent, verify_fingerprint,
dav_header=self.dav_header)
self.unsafe_href_chars = unsafe_href_chars
self.case_sensitive = case_sensitive

# defined for _repr_attributes
self.username = username
Expand All @@ -284,8 +285,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 1eefb30

Please sign in to comment.