Skip to content

Commit

Permalink
Strip bucket on GdriveFileSystem (#6618)
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored Sep 15, 2021
1 parent 18d147e commit 7521e91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 9 additions & 0 deletions dvc/fs/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@ def _with_bucket(self, path):

return super()._with_bucket(path)

def _strip_bucket(self, entry):
try:
bucket, path = entry.split("/", 1)
except ValueError:
# If there is no path attached, only returns
# the bucket (top-level).
bucket, path = entry, None
return path or bucket

def upload_fobj(self, fobj, to_info, **kwargs):
rpath = self._with_bucket(to_info)
self.makedirs(os.path.dirname(rpath))
Expand Down
4 changes: 1 addition & 3 deletions tests/func/test_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,7 @@ def test_download_callback(tmp_dir, dvc, cloud):
os.name == "nt", reason="unsupported on Windows."
),
),
pytest.param(
pytest.lazy_fixture("gdrive"), marks=pytest.mark.xfail(strict=True)
),
pytest.lazy_fixture("gdrive"),
],
)
def test_download_dir_callback(tmp_dir, dvc, cloud):
Expand Down

0 comments on commit 7521e91

Please sign in to comment.