From d60975bdb3067b5109fd8125499f2b85eed4cf80 Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Thu, 9 Jun 2016 15:58:43 +0200 Subject: [PATCH 1/2] Do not raise error if resourcetype is not specified --- webdav/client.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/webdav/client.py b/webdav/client.py index 043a429..cb95c39 100644 --- a/webdav/client.py +++ b/webdav/client.py @@ -843,10 +843,7 @@ def parse(response, path): path_with_sep = "{path}{sep}".format(path=path, sep=Urn.separate) if not path == urn and not path_with_sep == urn: continue - type = resp.find(".//{DAV:}resourcetype") - if type is None: - raise MethodNotSupported(name="is_dir", server=self.webdav.hostname) - dir_type = type.find("{DAV:}collection") + dir_type = resp.find(".//{DAV:}resourcetype/{DAV:}collection") return True if dir_type is not None else False From 872b32d17521e8d9eae7d2e75b0386a8f21efc68 Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Thu, 9 Jun 2016 16:09:44 +0200 Subject: [PATCH 2/2] check() to match directory without trailing slash Previously, '/path/to/mydir' would return false for an existing directory. Now it returns true. --- webdav/client.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/webdav/client.py b/webdav/client.py index cb95c39..e7288f5 100644 --- a/webdav/client.py +++ b/webdav/client.py @@ -278,12 +278,8 @@ def parse(response, path): href = resp.findtext("{DAV:}href") urn = unquote(href) - if path.endswith(Urn.separate): - if path == urn or path[:-1] == urn: - return True - else: - if path == urn: - return True + if path.rstrip(Urn.separate) == urn.rstrip(Urn.separate): + return True return False