mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
Use const slashSeparator instead of "/" everywhere (#8028)
This commit is contained in:
@@ -95,8 +95,8 @@ func isMetadataReplace(h http.Header) bool {
|
||||
// Splits an incoming path into bucket and object components.
|
||||
func path2BucketAndObject(path string) (bucket, object string) {
|
||||
// Skip the first element if it is '/', split the rest.
|
||||
path = strings.TrimPrefix(path, "/")
|
||||
pathComponents := strings.SplitN(path, "/", 2)
|
||||
path = strings.TrimPrefix(path, SlashSeparator)
|
||||
pathComponents := strings.SplitN(path, SlashSeparator, 2)
|
||||
|
||||
// Save the bucket and object extracted from path.
|
||||
switch len(pathComponents) {
|
||||
@@ -370,7 +370,7 @@ func getResource(path string, host string, domains []string) (string, error) {
|
||||
continue
|
||||
}
|
||||
bucket := strings.TrimSuffix(host, "."+domain)
|
||||
return slashSeparator + pathJoin(bucket, path), nil
|
||||
return SlashSeparator + pathJoin(bucket, path), nil
|
||||
}
|
||||
return path, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user