Skip to content

Commit

Permalink
[Bug] Key for S3Stream should not have leading slash (#10)
Browse files Browse the repository at this point in the history
* S3 key should not have leading slash

* Update s3_test.py
  • Loading branch information
eterna2 committed Oct 28, 2020
1 parent 45399d0 commit 98d725e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions iotoolz/extensions/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def __init__(
use_threads=use_threads or self._default_transfer_config.use_threads,
)
self._scheme, self.bucket, self.key, query, _ = urllib.parse.urlsplit(uri)
if self.key.startswith("/"):
self.key = self.key[1:]
# keep last query value
query_str = {
key: value[-1]
Expand Down
2 changes: 1 addition & 1 deletion iotoolz/extensions/s3_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_s3stream(s3):
assert stream.info.extras["Metadata"] == {"meta-key": "meta-value"}
assert stream.info.extras["StorageClass"] == "REDUCED_REDUNDANCY"

resp = s3.get_object_tagging(Bucket="somebucket", Key="/foo/bar.txt")
resp = s3.get_object_tagging(Bucket="somebucket", Key="foo/bar.txt")
assert resp["TagSet"] == [
{"Key": "key1", "Value": "value1"},
{"Key": "key2", "Value": "value2"},
Expand Down

0 comments on commit 98d725e

Please sign in to comment.