summaryrefslogtreecommitdiff
path: root/caddyconfig
diff options
context:
space:
mode:
Diffstat (limited to 'caddyconfig')
-rw-r--r--caddyconfig/load.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/caddyconfig/load.go b/caddyconfig/load.go
index bd47bea..9f5cda9 100644
--- a/caddyconfig/load.go
+++ b/caddyconfig/load.go
@@ -189,12 +189,11 @@ func adaptByContentType(contentType string, body []byte) ([]byte, []Warning, err
}
// adapter name should be suffix of MIME type
- slashIdx := strings.Index(ct, "/")
- if slashIdx < 0 {
+ _, adapterName, slashFound := strings.Cut(ct, "/")
+ if !slashFound {
return nil, nil, fmt.Errorf("malformed Content-Type")
}
- adapterName := ct[slashIdx+1:]
cfgAdapter := GetAdapter(adapterName)
if cfgAdapter == nil {
return nil, nil, fmt.Errorf("unrecognized config adapter '%s'", adapterName)