From 7a4e18774535b88900396ee816bde57c82d66916 Mon Sep 17 00:00:00 2001 From: Noste <83548733+Noooste@users.noreply.github.com> Date: Sun, 21 Dec 2025 15:29:19 +0100 Subject: [PATCH] feat: trim protocol from MinIO endpoint and set SSL flag Signed-off-by: Noste <83548733+Noooste@users.noreply.github.com> --- backend/internal/services/s3.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/internal/services/s3.go b/backend/internal/services/s3.go index 2bfbd81..ac14794 100644 --- a/backend/internal/services/s3.go +++ b/backend/internal/services/s3.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "strings" "time" "Noooste/garage-ui/internal/config" @@ -24,6 +25,16 @@ type S3Service struct { // NewS3Service creates a new S3 service instance using MinIO SDK func NewS3Service(cfg *config.GarageConfig, adminService *GarageAdminService) *S3Service { // Create MinIO client for Garage + // trim http or https from endpoint + if strings.HasPrefix(cfg.Endpoint, "http://") { + cfg.Endpoint = strings.TrimPrefix(cfg.Endpoint, "http://") + } + + if strings.HasPrefix(cfg.Endpoint, "https://") { + cfg.Endpoint = strings.TrimPrefix(cfg.Endpoint, "https://") + cfg.UseSSL = true + } + client, err := minio.New(cfg.Endpoint, &minio.Options{ //Creds: credentials.NewStaticV4(cfg.AccessKey, cfg.SecretKey, ""), Secure: cfg.UseSSL,