Fix Retention, ObjectLock, LegalHold struct namespaces correctly. (#8909)

Reverts #8903 to allow structs to be unmarshalled 
even if the namespace is missing.
This commit is contained in:
poornas
2020-01-29 20:28:05 -08:00
committed by GitHub
parent f6a7d4d29b
commit 881e983ed9
4 changed files with 24 additions and 8 deletions

View File

@@ -85,6 +85,7 @@ func (api objectAPIHandlers) GetBucketNotificationHandler(w http.ResponseWriter,
return
}
config.SetRegion(globalServerRegion)
config.XMLNS = "http://s3.amazonaws.com/doc/2006-03-01/"
notificationBytes, err := xml.Marshal(config)
if err != nil {
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r))
@@ -126,6 +127,11 @@ func (api objectAPIHandlers) GetBucketNotificationHandler(w http.ResponseWriter,
}
}
// If xml namespace is empty, set a default value before returning.
if config.XMLNS == "" {
config.XMLNS = "http://s3.amazonaws.com/doc/2006-03-01/"
}
notificationBytes, err := xml.Marshal(config)
if err != nil {
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r))