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

Strip protocol from paths in fsspec.generic.GenericFileSystem._copy #1577

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The following libraries use ``fsspec`` internally for path and file handling:
maintainable and modular data science code
#. `pyxet`_, a Python library for mounting and
accessing very large datasets from XetHub
#. `Huggingface🤗 Datasets`_, a popular library to
#. `Huggingface🤗 Datasets`_, a popular library to
load&manipulate data for Deep Learning models

``fsspec`` filesystems are also supported by:
Expand Down
5 changes: 5 additions & 0 deletions fsspec/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ async def _copy(
raise NotImplementedError
fs = _resolve_fs(path1[0], self.method)
fs2 = _resolve_fs(path2[0], self.method)

# strip all paths here, after resolve...
path1 = [fs._strip_protocol(p) for p in path1]
path2 = [fs2._strip_protocol(p) for p in path2]

# not expanding paths atm., assume call is from rsync()
if fs is fs2:
# pure remote
Expand Down
1 change: 1 addition & 0 deletions fsspec/implementations/sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def rmdir(self, path):
self.ftp.rmdir(path)

def info(self, path):
path = self._strip_protocol(path)
stat = self._decode_stat(self.ftp.stat(path))
stat["name"] = path
return stat
Expand Down