Skip to content

Commit

Permalink
gs: add {_strip,unstrip}_protocol
Browse files Browse the repository at this point in the history
fixes resolution of relative paths

fixes iterative/dvc#7638
  • Loading branch information
dtrifiro authored and efiop committed Jun 7, 2022
1 parent feecfba commit 1cca0ca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/dvc_objects/fs/implementations/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@ def fs(self):
from gcsfs import GCSFileSystem

return GCSFileSystem(**self.fs_args)

@classmethod
def _strip_protocol(cls, path: str) -> str:
from fsspec.utils import infer_storage_options

return infer_storage_options(path)["path"]

def unstrip_protocol(self, path: str) -> str:
return "gs://" + path.lstrip("/")

0 comments on commit 1cca0ca

Please sign in to comment.