Skip to content

Commit

Permalink
Fix selecting correct files when using ignore file in GcsBucket's `…
Browse files Browse the repository at this point in the history
…put_directory` (#13290)
  • Loading branch information
kevingrismore committed May 13, 2024
1 parent 3f5d6af commit b4e811d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,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
6 changes: 4 additions & 2 deletions src/integrations/prefect-gcp/tests/test_cloud_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,14 @@ def test_put_directory(self, gcs_bucket, tmp_path, to_path, ignore):
(local_path / "abc.html").write_text("<div>abc</div>")
(local_path / "cab.txt").write_text("cab")
(local_path / "some_dir").mkdir()
(local_path / "some_dir" / "nested_abc.html").write_text("<div>abc</div>")
(local_path / "some_dir" / "nested_cab.txt").write_text("cab")

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

Expand Down

0 comments on commit b4e811d

Please sign in to comment.