forked from TrueCloudLab/frostfs-s3-gw
[#195] Check object locking when disable versioning
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
e98c663bd6
commit
3046d80b37
1 changed files with 7 additions and 0 deletions
|
@ -2,6 +2,7 @@ package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-s3-gw/api"
|
"github.com/nspcc-dev/neofs-s3-gw/api"
|
||||||
|
@ -34,8 +35,14 @@ func (h *handler) PutBucketVersioningHandler(w http.ResponseWriter, r *http.Requ
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !p.Settings.VersioningEnabled && bktInfo.ObjectLockEnabled {
|
||||||
|
h.logAndSendError(w, "couldn't suspend bucket versioning", reqInfo, fmt.Errorf("object lock is enabled"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := h.obj.PutBucketVersioning(r.Context(), p); err != nil {
|
if _, err := h.obj.PutBucketVersioning(r.Context(), p); err != nil {
|
||||||
h.logAndSendError(w, "couldn't put update versioning settings", reqInfo, err)
|
h.logAndSendError(w, "couldn't put update versioning settings", reqInfo, err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue