0006-00000216

更新时间:
复制 MD 格式

Problem description

The value of the conditions parameter in the policy form field is invalid.

Causes

When you submit a PostObject request, OSS validates the policy and rejects it if any entry in the conditions array is missing its matching mode.

Examples

The following policy is invalid. The ["$key"] entry has no matching mode:

{
    "expiration": "2023-02-19T13:19:00.000Z",
    "conditions": [
        ["$key"],
        ["content-length-range", 0, 1048576000]
    ]
}

Solutions

Add a matching mode to every entry in the conditions array. The conditions value is a list that specifies valid values for form fields in the PostObject request. The following matching modes are supported:

Matching modeFormatDescription
eq["eq", "$field", "value"]Field must equal the specified value.
starts-with["starts-with", "$field", "prefix"]Field value must start with the specified prefix.
content-length-range["content-length-range", min, max]Object size must be within the specified byte range.
in["in", "$field", ["v1", "v2"]]Field value must be one of the listed values.
not-in["not-in", "$field", ["v1", "v2"]]Field value must not be any of the listed values.

The following example shows a corrected policy where $key uses starts-with:

{
    "expiration": "2023-02-19T13:19:00.000Z",
    "conditions": [
        ["starts-with", "$key", "user/user1"],
        ["content-length-range", 0, 1048576000]
    ]
}

References