0006-00000221

更新时间:
复制 MD 格式

Problem description

The content-length-range condition in the PostObject policy contains an invalid value.

Causes

When you submit a PostObject request, OSS validates the content-length-range condition in the conditions field of the policy form field. This condition sets the minimum and maximum allowed sizes for the uploaded object and must follow this format:

["content-length-range", min-len, max-len]

Both min-len and max-len must be positive integers, and max-len must be greater than or equal to min-len. Otherwise, an error is returned.

Examples

The following policy is invalid because max-len is set to "test" instead of a positive integer:

{
    "expiration": "2023-02-19T13:19:00.000Z",
    "conditions": [
        ["content-length-range", 10, "test"]
    ]
}

Solutions

Set both min-len and max-len to positive integers, with max-len greater than or equal to min-len:

{
    "expiration": "2023-02-19T13:19:00.000Z",
    "conditions": [
        ["content-length-range", 1, 1024]
    ]
}

References