Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: getinfo retrieve excess path #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions webdavfs/webdavfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ def getinfo(self, path, namespaces=None):
if path in self.info_cache:
info = self.info_cache[path]
else:
from urllib.parse import urlparse
import os
parsed_url = urlparse(self.client.webdav.hostname)
parent_path = os.path.join(parsed_url.path, _path.strip('/'))
if not parent_path.endswith('/'):
parent_path += '/'
response = self.client.execute_request(action='info',
path=urn.quote())
info = wc.WebDavXmlUtils.parse_info_response(content=response.content, path=path, hostname=self.client.webdav.hostname)
Expand All @@ -275,6 +281,8 @@ def getinfo(self, path, namespaces=None):
info['isdir'] = True
info['files'] = []
for i in wc.WebDavXmlUtils.parse_get_list_info_response(response.content):
if parent_path == i['path']:
continue
if i['path'].rstrip('/') != path.rstrip('/'):
if i['name'] is None:
i['name'] = i['path'].split("/")[-1]
Expand Down