From 067442f3483edda802090f8b929a76be0b591ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saugat=20Pachhai=20=28=E0=A4=B8=E0=A5=8C=E0=A4=97=E0=A4=BE?= =?UTF-8?q?=E0=A4=A4=29?= Date: Thu, 31 Mar 2022 14:35:40 +0545 Subject: [PATCH] webdav: consider path to be root Remove _strip_protocol, moves to get_cloud_fs loading stage. --- dvc/fs/__init__.py | 7 ++++++- dvc/fs/webdav.py | 9 +-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/dvc/fs/__init__.py b/dvc/fs/__init__.py index 4797ec202..6d289f2cf 100644 --- a/dvc/fs/__init__.py +++ b/dvc/fs/__init__.py @@ -114,7 +114,12 @@ def get_cloud_fs(repo, **kwargs): remote_conf["gdrive_credentials_tmp_dir"] = repo.tmp_dir url = remote_conf.pop("url") - fs_path = cls._strip_protocol(url) # pylint:disable=protected-access + if issubclass(cls, WebDAVFileSystem): + # For WebDAVFileSystem, provided url is the base path itself, so it + # should be treated as being a root path. + fs_path = cls.root_marker + else: + fs_path = cls._strip_protocol(url) # pylint:disable=protected-access extras = cls._get_kwargs_from_urls(url) # pylint:disable=protected-access conf = {**extras, **remote_conf} # remote config takes priority diff --git a/dvc/fs/webdav.py b/dvc/fs/webdav.py index 0eac67867..4fb8a766b 100644 --- a/dvc/fs/webdav.py +++ b/dvc/fs/webdav.py @@ -13,6 +13,7 @@ logger = logging.getLogger(__name__) class WebDAVFileSystem(FSSpecWrapper): # pylint:disable=abstract-method scheme = Schemes.WEBDAV + root_marker = "" CAN_TRAVERSE = True TRAVERSE_PREFIX_LEN = 2 REQUIRES = {"webdav4": "webdav4"} @@ -33,14 +34,6 @@ class WebDAVFileSystem(FSSpecWrapper): # pylint:disable=abstract-method } ) - @classmethod - def _strip_protocol(cls, path: str) -> str: - """ - For WebDAVFileSystem, provided url is the base path itself, so it - should be treated as being a root path. - """ - return "" - def unstrip_protocol(self, path: str) -> str: return self.fs_args["base_url"] + "/" + path