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 Jan 8, 2015
1 parent e6a5fbf commit eac992d
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 @@ -288,13 +288,14 @@ 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('/') + '/'
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 Down Expand Up @@ -347,8 +348,10 @@ def create_collection(cls, collection, **kwargs):
rv['url'] = response.url
return rv

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 eac992d

Please sign in to comment.