mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
all/windows: Be case in-sensitive about pattern matching. (#3682)
Resource strings and paths are case insensitive on windows deployments but if user happens to use upper case instead of lower case for certain configuration params like bucket policies and bucket notification config. We might not honor them which leads to a wrong behavior on windows. This is windows only behavior, for all other platforms case is still kept sensitive.
This commit is contained in:
@@ -21,6 +21,8 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
mux "github.com/gorilla/mux"
|
||||
@@ -63,6 +65,10 @@ func bucketPolicyActionMatch(action string, statement policyStatement) bool {
|
||||
|
||||
// Match function matches wild cards in 'pattern' for resource.
|
||||
func resourceMatch(pattern, resource string) bool {
|
||||
if runtime.GOOS == "windows" {
|
||||
// For windows specifically make sure we are case insensitive.
|
||||
return wildcard.Match(strings.ToLower(pattern), strings.ToLower(resource))
|
||||
}
|
||||
return wildcard.Match(pattern, resource)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user