Skip to content

Commit 0b56381

Browse files
authored
Enhance the robustness about parse bucket (#236)
1 parent 9ac3614 commit 0b56381

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

tosfs/tests/test_utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
[
2424
("bucket/key", ("bucket", "key")),
2525
("bucket/", ("bucket", "")),
26+
("tos://bucket/key", ("bucket", "key")),
27+
("tos://bucket/", ("bucket", "")),
2628
("/key", ("", "key")),
2729
("bucket/key/with/slashes", ("bucket", "key/with/slashes")),
2830
("bucket", ("bucket", "")),

tosfs/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def find_bucket_key(tos_path: str) -> Tuple[str, str]:
7272
r"^(?P<bucket>:tos-object-lambda:[a-z\-0-9]+:[0-9]{12}:"
7373
r"accesspoint[/:][a-zA-Z0-9\-]{1,63})[/:]?(?P<key>.*)$"
7474
),
75+
re.compile(r"^tos://(?P<bucket>[^/]+)/(?P<key>.*)$"),
7576
]
7677
for bucket_format in bucket_format_list:
7778
match = bucket_format.match(tos_path)

0 commit comments

Comments
 (0)