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

Commit

Permalink
Stop resolve_path defaulting to random UUID if path is "" (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 authored Feb 23, 2023
1 parent 7a17997 commit 6b2ce3b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fixed errors raised when using `write_path` and `read_path` with `credentials` field on `S3Bucket` - [#208](https://github.com/PrefectHQ/prefect-aws/pull/208)
- Resolving paths in `S3Bucket` unintentionally generating an arbitrary UUID when path is an empty string - [#212](https://github.com/PrefectHQ/prefect-gcp/pull/212)

## 0.2.4

Expand Down
4 changes: 0 additions & 4 deletions prefect_aws/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import warnings
from pathlib import Path, PurePath
from typing import Any, BinaryIO, Dict, List, Optional, Union
from uuid import uuid4

import boto3
from botocore.paginate import PageIterator
Expand Down Expand Up @@ -402,9 +401,6 @@ def _resolve_path(self, path: str) -> str:
bucket has a unique key (or key name).
"""

path = path or str(uuid4())

bucket_folder = self.bucket_folder or self.basepath
# If basepath provided, it means we won't write to the root dir of
# the bucket. So we need to add it on the front of the path.
Expand Down
4 changes: 4 additions & 0 deletions tests/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ def test_deployment_set_basepath(aws_creds_block, type_):
assert deployment.location == "home/"


def test_resolve_path(s3_bucket):
assert s3_bucket._resolve_path("") == ""


class TestS3Bucket:
@pytest.fixture(
params=[
Expand Down

0 comments on commit 6b2ce3b

Please sign in to comment.