Skip to content

Commit 8671f8a

Browse files
authored
Also parse the host from VPC style urls (#50)
* Also parse the host from VPC style urls * v1.6.3
1 parent 0c8f299 commit 8671f8a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CloudStore"
22
uuid = "3365d9ee-d53b-4a56-812d-5344d5b716d7"
33
authors = ["quinnj <[email protected]>"]
4-
version = "1.6.2"
4+
version = "1.6.3"
55

66
[deps]
77
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/parse.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ function parseAWSBucketRegionKey(url; parseLocal::Bool=false)
142142
### See: https://docs.aws.amazon.com/AmazonS3/latest/userguide/privatelink-interface-endpoints.html
143143
# https://bucket.vpce-1a2b3c4d-5e6f.s3.region-code.vpce.amazonaws.com/bucket-name/key-name
144144
# https://bucket.vpce-1a2b3c4d-5e6f.s3.region-code.vpce.amazonaws.com/bucket-name
145-
m = match(r"^https://bucket\.vpce[^\.]+\.s3\.(?<region>[^\.]+)\.vpce\.amazonaws\.com/(?<bucket>[^/]+)(?:/(?<key>.+))?$"i, url)
146-
m !== nothing && return _validate_aws(true, false, nothing, m[:bucket], m[:region], m[:key])
145+
m = match(r"^(?<host>https://bucket\.vpce[^\.]+\.s3\.(?<region>[^\.]+)\.vpce\.amazonaws\.com)/(?<bucket>[^/]+)(?:/(?<key>.+))?$"i, url)
146+
m !== nothing && return _validate_aws(true, false, m[:host], m[:bucket], m[:region], m[:key])
147147
# https://s3.region-code.amazonaws.com/bucket-name/key-name
148148
# https://s3.region-code.amazonaws.com/bucket-name
149149
m = match(r"^https://s3(?:\.(?<region>[^\.]+))?\.amazonaws\.com/(?<bucket>[^/]+)(?:/(?<key>.+))?$"i, url)

test/runtests.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,8 @@ end
532532
("HTtp://127.0.0.1:27181/bucket-name/key-name", (true, false, "HTtp://127.0.0.1:27181", "bucket-name", "", "key-name")),
533533
("htTP://127.0.0.1:27181/bucket-name", (true, false, "htTP://127.0.0.1:27181", "bucket-name", "", "")),
534534

535-
("https://bucket.vpce-1a2b3c4d-5e6f.s3.us-west-2.vpce.amazonaws.com/bucket-name", (true, false, nothing, "bucket-name", "us-west-2", "")),
536-
("https://bucket.vpce-1a2b3c4d-5e6f.s3.us-west-2.vpce.amazonaws.com/bucket-name/key-name", (true, false, nothing, "bucket-name", "us-west-2", "key-name")),
535+
("https://bucket.vpce-1a2b3c4d-5e6f.s3.us-west-2.vpce.amazonaws.com/bucket-name", (true, false, "https://bucket.vpce-1a2b3c4d-5e6f.s3.us-west-2.vpce.amazonaws.com", "bucket-name", "us-west-2", "")),
536+
("https://bucket.vpce-1a2b3c4d-5e6f.s3.us-west-2.vpce.amazonaws.com/bucket-name/key-name", (true, false, "https://bucket.vpce-1a2b3c4d-5e6f.s3.us-west-2.vpce.amazonaws.com", "bucket-name", "us-west-2", "key-name")),
537537
]
538538
for (url, parts) in s3
539539
ok, accelerate, host, bucket, reg, key = CloudStore.parseAWSBucketRegionKey(url; parseLocal=true)

0 commit comments

Comments
 (0)