From c5fd977c3d3fa19382f0749002e7e5ffc6b43b60 Mon Sep 17 00:00:00 2001 From: Bram Verhulst Date: Sat, 22 Aug 2026 21:08:02 +0200 Subject: [PATCH] pls fucking work --- backend/cmd/server/main.go | 1 - backend/internal/storage/storage.go | 31 ----------------------------- 2 files changed, 32 deletions(-) diff --git a/backend/cmd/server/main.go b/backend/cmd/server/main.go index a92508d..c17acd3 100644 --- a/backend/cmd/server/main.go +++ b/backend/cmd/server/main.go @@ -52,7 +52,6 @@ func main() { Bucket: cfg.StorageBucket, UseSSL: cfg.StorageUseSSL, PublicUseSSL: true, - CORSOrigins: cfg.CORSOrigin, }) if err != nil { log.Fatalf("storage unavailable: %v", err) diff --git a/backend/internal/storage/storage.go b/backend/internal/storage/storage.go index ab0c4a8..3ee4dbd 100644 --- a/backend/internal/storage/storage.go +++ b/backend/internal/storage/storage.go @@ -4,11 +4,9 @@ import ( "context" "fmt" "io" - "strings" "time" "github.com/minio/minio-go/v7" - "github.com/minio/minio-go/v7/pkg/cors" "github.com/minio/minio-go/v7/pkg/credentials" ) @@ -20,7 +18,6 @@ type Config struct { Bucket string UseSSL bool PublicUseSSL bool - CORSOrigins string } type ObjectInfo struct { @@ -44,7 +41,6 @@ type MinIO struct { client *minio.Client publicClient *minio.Client bucket string - corsOrigins string } func NewMinIO(config Config) (*MinIO, error) { @@ -74,7 +70,6 @@ func NewMinIO(config Config) (*MinIO, error) { client: client, publicClient: publicClient, bucket: config.Bucket, - corsOrigins: config.CORSOrigins, }, nil } @@ -91,32 +86,6 @@ func (s *MinIO) EnsureBucket(ctx context.Context) error { } } } - origins := make([]string, 0) - for _, origin := range strings.Split(s.corsOrigins, ",") { - if value := strings.TrimSpace(origin); value != "" { - origins = append(origins, value) - } - } - if len(origins) == 0 { - origins = []string{"*"} - } - if err := s.client.SetBucketCors(ctx, s.bucket, cors.NewConfig([]cors.Rule{{ - ID: "studio-browser-uploads", - AllowedOrigin: origins, - AllowedMethod: []string{"GET", "PUT", "POST", "DELETE", "HEAD"}, - AllowedHeader: []string{ - "Content-Type", - "x-amz-acl", - "x-amz-date", - "x-amz-content-sha256", - "Authorization", - "Origin", - }, - ExposeHeader: []string{"ETag", "x-amz-request-id", "x-amz-id-2"}, - MaxAgeSeconds: 3600, - }})); err != nil { - return fmt.Errorf("configure object storage CORS: %w", err) - } return nil }