aboutsummaryrefslogtreecommitdiffhomepage
path: root/caddyconfig/load.go
diff options
context:
space:
mode:
authorWilczyƄskiT <[email protected]>2022-08-04 19:17:35 +0200
committerGitHub <[email protected]>2022-08-04 11:17:35 -0600
commit2642bd72b7ca35b8622824fdffced2aefe1aaf11 (patch)
tree3bc73bada610bfee6377eb58d89ca18b72236966 /caddyconfig/load.go
parent17ae5acaba536e98cfa86ddcd6967801f1fa1bbe (diff)
downloadcaddy-2642bd72b7ca35b8622824fdffced2aefe1aaf11.tar.gz
caddy-2642bd72b7ca35b8622824fdffced2aefe1aaf11.zip
Replace strings.Index usages with strings.Cut (#4930)
Diffstat (limited to 'caddyconfig/load.go')
-rw-r--r--caddyconfig/load.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/caddyconfig/load.go b/caddyconfig/load.go
index bd47bea44..9f5cda905 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)