From e05548c54f85999ca6bc507482e7098cca03cfd9 Mon Sep 17 00:00:00 2001 From: romrom1948 Date: Mon, 25 Mar 2019 12:16:48 +0100 Subject: [PATCH 1/5] Fix RemoteResourceNotFound in Request::info when webdav_root includes special characters on ownCloud/NextCloud server --- webdav/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webdav/client.py b/webdav/client.py index a331928..c3bd361 100644 --- a/webdav/client.py +++ b/webdav/client.py @@ -765,7 +765,8 @@ def parse(response, path): continue else: path_with_sep = "{path}{sep}".format(path=path, sep=Urn.separate) - if not path == urn and not path_with_sep == urn: + path_unquoted = unquote(path) + if not path == urn and not path_with_sep == urn and not path_unquoted == urn: continue info = dict() From 978aee76d0ed737848b9a6ffe5da10c049cfec41 Mon Sep 17 00:00:00 2001 From: romrom1948 Date: Tue, 26 Mar 2019 10:51:29 +0100 Subject: [PATCH 2/5] Fix RemoteResourceNotFound in Request::is_dir when webdav_root includes special characters with ownCloud/NextCloud server --- webdav/client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webdav/client.py b/webdav/client.py index a331928..0852945 100644 --- a/webdav/client.py +++ b/webdav/client.py @@ -824,7 +824,9 @@ def parse(response, path): continue else: path_with_sep = "{path}{sep}".format(path=path, sep=Urn.separate) - if not path == urn and not path_with_sep == urn: + path_unquoted = unquote(path) + + if not path == urn and not path_with_sep == urn and not path_unquoted == urn: continue type = resp.find(".//{DAV:}resourcetype") if type is None: From 9a887c8e153b076229731e772db61f0b9ebfa2cd Mon Sep 17 00:00:00 2001 From: Romrom Date: Wed, 6 Nov 2019 13:39:41 +0100 Subject: [PATCH 3/5] Add etag support in webdav.client.info() (code from https://github.com/CloudPolis/webdav-client-python/issues/14) --- webdav/client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webdav/client.py b/webdav/client.py index 42be35f..e1d354c 100644 --- a/webdav/client.py +++ b/webdav/client.py @@ -751,7 +751,8 @@ def parse(response, path): 'created': ".//{DAV:}creationdate", 'name': ".//{DAV:}displayname", 'size': ".//{DAV:}getcontentlength", - 'modified': ".//{DAV:}getlastmodified" + 'modified': ".//{DAV:}getlastmodified", + 'etag': ".//{DAV:}getetag" } resps = tree.findall("{DAV:}response") @@ -773,6 +774,11 @@ def parse(response, path): for (name, value) in find_attributes.items(): info[name] = resp.findtext(value) return info + + try: + info['etag'] = info['etag'][1:-1] # remove quotes from etag + except KeyError: + pass raise RemoteResourceNotFound(path) except etree.XMLSyntaxError: From e5203f9e6a4be17c4c0c7404e80e7dbd183b9dbb Mon Sep 17 00:00:00 2001 From: Romrom Date: Wed, 6 Nov 2019 13:40:08 +0100 Subject: [PATCH 4/5] Fix bug in #e05548c54f85999ca6bc507482e7098cca03cfd9 --- webdav/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webdav/client.py b/webdav/client.py index e1d354c..5ceb3b0 100644 --- a/webdav/client.py +++ b/webdav/client.py @@ -807,7 +807,7 @@ def parse(response, path): path = "{root}{path}".format(root=self.webdav.root, path=urn.path()) - return parse(response, path) + return parse(response, unquote(path)) except pycurl.error: raise NotConnection(self.webdav.hostname) From d5723b9b9a41372e8f41034f0bc00a2762c7993e Mon Sep 17 00:00:00 2001 From: Romrom Date: Thu, 14 Nov 2019 15:28:04 +0100 Subject: [PATCH 5/5] Fix the output of Request::list when path includes special characters with ownCloud/NextCloud server --- webdav/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webdav/client.py b/webdav/client.py index 5ceb3b0..df37569 100644 --- a/webdav/client.py +++ b/webdav/client.py @@ -219,7 +219,7 @@ def parse(response): urns = parse(response) path = "{root}{path}".format(root=self.webdav.root, path=directory_urn.path()) - return [urn.filename() for urn in urns if urn.path() != path and urn.path() != path[:-1]] + return [urn.filename() for urn in urns if urn.path() != unquote(path) and urn.path() != unquote(path[:-1])] except pycurl.error: raise NotConnection(self.webdav.hostname)