fix: Fixes the bucket policy json document validation errors for invalid jsons.

Fixes #965

Changes the returned error description to `Policies must be valid JSON and the first byte must be '{'` for invalid bucket policy json documents, which doesn't start with `{`.
The gateway returns `This policy contains invalid Json` error description, if the document starts with `{`, but still isn't valid json.

Implements the `policyErr` string type which implements the `error` interface, to handle the policy json document validation errors, by avoiding staticchecker warnings.
This commit is contained in:
niksis02
2025-03-20 01:08:47 +04:00
parent 1eb905bf14
commit d82da64942
8 changed files with 92 additions and 48 deletions

View File

@@ -634,8 +634,7 @@ func TestS3ApiController_PutBucketActions(t *testing.T) {
</VersioningConfiguration>
`
policyBody := `
{
policyBody := `{
"Statement": [
{
"Effect": "Allow",