fix: minio-go must sign with Garage region ('garage', not AWS us-east-1)

This commit is contained in:
sam
2026-09-10 07:18:37 +10:00
parent 5acddaa605
commit dd029c8819

View File

@@ -47,7 +47,8 @@ func NewMediaClient() *MediaClient {
} else if strings.HasPrefix(addr, "https://") { } else if strings.HasPrefix(addr, "https://") {
addr = strings.TrimPrefix(addr, "https://") addr = strings.TrimPrefix(addr, "https://")
} }
cl, err := minio.New(addr, mc.Key, mc.Secret, secure) // Garage region is "garage" (not AWS us-east-1) — critical for SigV4 scope.
cl, err := minio.NewWithRegion(addr, mc.Key, mc.Secret, secure, "garage")
if err != nil { if err != nil {
mc.Err = err mc.Err = err
} else { } else {
@@ -80,6 +81,7 @@ func (c *MediaClient) Get(name string, w http.ResponseWriter) bool {
} }
data, derr := io.ReadAll(obj) data, derr := io.ReadAll(obj)
if derr != nil { if derr != nil {
log.Printf("media read %s: %v", name, derr)
http.Error(w, "media read error", http.StatusBadGateway) http.Error(w, "media read error", http.StatusBadGateway)
return false return false
} }