summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2024-04-11 17:04:43 -0600
committerMatthew Holt <[email protected]>2024-04-11 17:04:43 -0600
commite1f4b83ffaa861e8f383ba52108e6449b53217f2 (patch)
tree381f2b9a3de592f2e96d6acde10412b26ecdedfe
parent185ed6fe7c14a88512d7cdcc308477a4f58cca4b (diff)
downloadcaddy-e1f4b83ffaa861e8f383ba52108e6449b53217f2.tar.gz
caddy-e1f4b83ffaa861e8f383ba52108e6449b53217f2.zip
cmd: Fix panic related to config filename (fix #5919)
-rw-r--r--cmd/main.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/main.go b/cmd/main.go
index 9be3585b9..ac9786faf 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -165,7 +165,7 @@ func loadConfigWithLogger(logger *zap.Logger, configFile, adapterName string) ([
baseConfigExt := filepath.Ext(baseConfig)
if (strings.HasPrefix(baseConfig, "caddyfile") ||
strings.HasSuffix(baseConfig, ".caddyfile")) &&
- caddyconfig.GetAdapter(baseConfigExt[1:]) == nil &&
+ (len(baseConfigExt) == 0 || caddyconfig.GetAdapter(baseConfigExt[1:]) == nil) &&
baseConfigExt != ".json" &&
adapterName == "" {
adapterName = "caddyfile"