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

Stop resolve_path defaulting to random UUID if path is "" #212

Merged
merged 2 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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