diff --git a/cmd/s3-gw/app.go b/cmd/s3-gw/app.go index 96ad889..45685af 100644 --- a/cmd/s3-gw/app.go +++ b/cmd/s3-gw/app.go @@ -239,6 +239,7 @@ func newAppSettings(log *Logger, v *viper.Viper) *appSettings { func (s *appSettings) update(v *viper.Viper, log *zap.Logger) { namespaceHeader := v.GetString(cfgResolveNamespaceHeader) nsConfig, defaultNamespaces := fetchNamespacesConfig(log, v) + vhsNamespacesEnabled := s.prepareVHSNamespaces(v, log, defaultNamespaces) defaultXMLNS := v.GetBool(cfgKludgeUseDefaultXMLNS) bypassContentEncodingInChunks := v.GetBool(cfgKludgeBypassContentEncodingCheckInChunks) clientCut := v.GetBool(cfgClientCut) @@ -253,7 +254,6 @@ func (s *appSettings) update(v *viper.Viper, log *zap.Logger) { vhsEnabled := v.GetBool(cfgVHSEnabled) vhsHeader := v.GetString(cfgVHSHeader) servernameHeader := v.GetString(cfgServernameHeader) - vhsNamespacesEnabled := s.prepareVHSNamespaces(v, log) httpLoggingEnabled := v.GetBool(cfgHTTPLoggingEnabled) httpLoggingMaxBody := v.GetInt64(cfgHTTPLoggingMaxBody) httpLoggingMaxLogSize := v.GetInt(cfgHTTPLoggingMaxLogSize) @@ -290,11 +290,14 @@ func (s *appSettings) update(v *viper.Viper, log *zap.Logger) { s.vhsNamespacesEnabled = vhsNamespacesEnabled } -func (s *appSettings) prepareVHSNamespaces(v *viper.Viper, log *zap.Logger) map[string]bool { +func (s *appSettings) prepareVHSNamespaces(v *viper.Viper, log *zap.Logger, defaultNamespaces []string) map[string]bool { nsMap := fetchVHSNamespaces(v, log) vhsNamespaces := make(map[string]bool, len(nsMap)) for ns, flag := range nsMap { - vhsNamespaces[s.ResolveNamespaceAlias(ns)] = flag + if slices.Contains(defaultNamespaces, ns) { + ns = defaultNamespace + } + vhsNamespaces[ns] = flag } return vhsNamespaces