0006-00000224

更新时间:
复制 MD 格式

Problem description

A PostObject request fails when a parameter in the conditions array of the policy form field has an incorrect data type.

Causes

A PostObject request fails because a parameter for an operator in the conditions array of the policy has an incorrect data type.

Example

A request error occurs in the following example because the not-in operator, which requires the data type of the second parameter to be a list, is used with the string "no-cache".

{
    "expiration": "2023-02-19T13:19:00.000Z",
    "conditions": [
      	["not-in", "cache-control", "no-cache"]
    ]
}

Solution

The following example shows a policy with correctly configured conditions for various operators.

{
    "expiration": "2023-02-19T13:19:00.000Z",
    "conditions": [    
        ["content-length-range", 1, 1024],
        ["eq", "$success_action_status", "201"],
        ["starts-with", "$key", "user/eric/"],
        ["in", "$content-type", ["image/jpeg", "image/png"]],
        ["not-in", "$cache-control", ["no-cache"]]
    ]
}

References