forked from TrueCloudLab/frostfs-s3-gw
[#306] Handle empty post policy
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
5fba97daa1
commit
76042f6728
1 changed files with 2 additions and 1 deletions
|
@ -368,7 +368,7 @@ func (h *handler) PostObject(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkPostPolicy(r *http.Request, reqInfo *api.ReqInfo, metadata map[string]string) (*postPolicy, error) {
|
func checkPostPolicy(r *http.Request, reqInfo *api.ReqInfo, metadata map[string]string) (*postPolicy, error) {
|
||||||
policy := &postPolicy{}
|
policy := &postPolicy{empty: true}
|
||||||
if policyStr := auth.MultipartFormValue(r, "policy"); policyStr != "" {
|
if policyStr := auth.MultipartFormValue(r, "policy"); policyStr != "" {
|
||||||
policyData, err := base64.StdEncoding.DecodeString(policyStr)
|
policyData, err := base64.StdEncoding.DecodeString(policyStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -380,6 +380,7 @@ func checkPostPolicy(r *http.Request, reqInfo *api.ReqInfo, metadata map[string]
|
||||||
if policy.Expiration.Before(time.Now()) {
|
if policy.Expiration.Before(time.Now()) {
|
||||||
return nil, fmt.Errorf("policy is expired: %w", errors.GetAPIError(errors.ErrInvalidArgument))
|
return nil, fmt.Errorf("policy is expired: %w", errors.GetAPIError(errors.ErrInvalidArgument))
|
||||||
}
|
}
|
||||||
|
policy.empty = false
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, v := range r.MultipartForm.Value {
|
for key, v := range r.MultipartForm.Value {
|
||||||
|
|
Loading…
Reference in a new issue