From b42e4e2c42819823773b09d6cb350ec31210f050 Mon Sep 17 00:00:00 2001 From: Yifei Sun Date: Sun, 6 Sep 2026 12:06:19 +0200 Subject: [PATCH] s3: trim separators from the configured prefix --- s3.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/s3.go b/s3.go index 255bc75..1d5b5fa 100644 --- a/s3.go +++ b/s3.go @@ -192,6 +192,8 @@ func (s3 *S3) Provision(ctx caddy.Context) error { if s3.Prefix == "" { s3.Prefix = os.Getenv("S3_PREFIX") } + // a separator at either end puts every key under a "/" directory that listings never find + s3.Prefix = strings.Trim(s3.Prefix, "/") if !s3.Insecure { insecure := os.Getenv("S3_INSECURE") -- knotmirror 0.0.1