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