Skip to content

Commit

Permalink
perf: 优化自定义 s3 服务上传问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc committed Mar 5, 2024
1 parent 3960738 commit b53afc5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/storage/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ func ParseEndpointRegion(s string) string {
if strings.Contains(s, amazonawsSuffix) {
return ParseAWSURLRegion(s)
}
endpoints := strings.Split(s, ".")
endpoint, err := url.Parse(s)
if err != nil {
return ""
}
endpoints := strings.Split(endpoint.Hostname(), ".")
if len(endpoints) >= 3 {
return endpoints[len(endpoints)-3]
}
Expand Down

0 comments on commit b53afc5

Please sign in to comment.