Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

fix: Bug that put_directory method in cloud_storage.py(GcsBucket) do not upload files that in directory #188

Closed
wants to merge 9 commits into from
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

### Fixed
- Bug that `put_directory` method in `cloud_storage.py`(GcsBucket) do not upload files that in directory

- Fix `list_folders` and `list_blobs` now logging bucket name and bucket path - [#184](https://github.com/PrefectHQ/prefect-gcp/pull/214)

Expand Down
2 changes: 1 addition & 1 deletion prefect_gcp/cloud_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ async def put_directory(
for local_file_path in Path(local_path).rglob("*"):
if (
included_files is not None
and local_file_path.name not in included_files
and str(local_file_path.relative_to(local_path)) not in included_files
):
continue
elif not local_file_path.is_dir():
Expand Down
5 changes: 4 additions & 1 deletion tests/test_cloud_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,14 @@ def test_put_directory(self, gcs_bucket, tmp_path, to_path, ignore):
(local_path / "cab.txt").write_text("cab")
(local_path / "some_dir").mkdir()

(local_path / "some_dir/text_file_in_dir.txt").write_text("hello")
(local_path / "some_dir/html_file_in_dir.html").write_text("<html>hello</html>")

expected = 2
if ignore:
ignore_file = tmp_path / "ignore.txt"
ignore_file.write_text("*.html")
expected -= 1
expected -= 2
else:
ignore_file = None

Expand Down
Loading