From 02705dc6ed6075cd979dc41ee6e408d7d22649a2 Mon Sep 17 00:00:00 2001 From: Admin Date: Sat, 14 Mar 2026 15:19:02 +0500 Subject: [PATCH] fix(storage): strip http/https scheme from MinIO endpoint env vars --- scraper/internal/storage/minio.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scraper/internal/storage/minio.go b/scraper/internal/storage/minio.go index 569fbec..77589bc 100644 --- a/scraper/internal/storage/minio.go +++ b/scraper/internal/storage/minio.go @@ -37,6 +37,13 @@ type MinioClient struct { // NewMinioClient creates a connected MinIO client and ensures the required // buckets exist. func NewMinioClient(ctx context.Context, cfg MinioConfig) (*MinioClient, error) { + // minio-go expects a bare "host:port" endpoint — strip any scheme prefix that + // callers may accidentally include (e.g. "https://minio.example.com"). + cfg.Endpoint = strings.TrimPrefix(strings.TrimPrefix(cfg.Endpoint, "https://"), "http://") + if cfg.PublicEndpoint != "" { + cfg.PublicEndpoint = strings.TrimPrefix(strings.TrimPrefix(cfg.PublicEndpoint, "https://"), "http://") + } + c, err := minio.New(cfg.Endpoint, &minio.Options{ Creds: credentials.NewStaticV4(cfg.AccessKey, cfg.SecretKey, ""), Secure: cfg.UseSSL,