mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(object): file size is not checked when content-length-range is not specified in the policy
Signed-off-by: yhjiango <jiangyunhua@oppo.com>
This commit is contained in:
parent
b5e1e55811
commit
5574a77cfb
@ -295,19 +295,20 @@ func (p *PostPolicy) Match(forms map[string]string) error {
|
||||
delete(allNeedKeys, key)
|
||||
}
|
||||
|
||||
if size := forms["content-length"]; size != "" {
|
||||
size := forms["content-length"]
|
||||
lengthMin := p.Conditions.ContentLengthRange.Min
|
||||
lengthMax := p.Conditions.ContentLengthRange.Max
|
||||
if lengthMax > 0 {
|
||||
fsize, _ := strconv.ParseInt(size, 10, 64)
|
||||
lengthMin := p.Conditions.ContentLengthRange.Min
|
||||
lengthMax := p.Conditions.ContentLengthRange.Max
|
||||
if fsize < lengthMin || (lengthMax > 0 && fsize > lengthMax) {
|
||||
if size == "" || fsize < lengthMin || fsize > lengthMax {
|
||||
return &ErrorCode{
|
||||
ErrorCode: "PolicyConditionNotMatch",
|
||||
ErrorMessage: "The content-length does not match the policy's content-length-range.",
|
||||
StatusCode: http.StatusForbidden,
|
||||
}
|
||||
}
|
||||
delete(allNeedKeys, "content-length")
|
||||
}
|
||||
delete(allNeedKeys, "content-length")
|
||||
|
||||
var keys []string
|
||||
for key := range allNeedKeys {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user