Skip to content

Commit

Permalink
Enhance the robustness about parse bucket (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua authored Oct 24, 2024
1 parent 9ac3614 commit 0b56381
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tosfs/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
[
("bucket/key", ("bucket", "key")),
("bucket/", ("bucket", "")),
("tos://bucket/key", ("bucket", "key")),
("tos://bucket/", ("bucket", "")),
("/key", ("", "key")),
("bucket/key/with/slashes", ("bucket", "key/with/slashes")),
("bucket", ("bucket", "")),
Expand Down
1 change: 1 addition & 0 deletions tosfs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def find_bucket_key(tos_path: str) -> Tuple[str, str]:
r"^(?P<bucket>:tos-object-lambda:[a-z\-0-9]+:[0-9]{12}:"
r"accesspoint[/:][a-zA-Z0-9\-]{1,63})[/:]?(?P<key>.*)$"
),
re.compile(r"^tos://(?P<bucket>[^/]+)/(?P<key>.*)$"),
]
for bucket_format in bucket_format_list:
match = bucket_format.match(tos_path)
Expand Down

0 comments on commit 0b56381

Please sign in to comment.