owncloud / owncloud/ocis

[SharingNg] Error message for invalid shares

Open
#8,163 8 comments 0 reactions 0 assignees View on GitHub
Type:Bug
Dominant language
Go
Stars
2.1k
Forks
274
Avg merge
2d 1h
Merged PRs (30d)
103

Description

## Describe the bug
When a user tries to share a resource to a multiple group, then the status code is `400` as expected and we get the following error message:
```json
{
"error": {
"code": "invalidRequest",
"innererror": {
"date": "2024-01-10T04:17:57Z",
"request-id": "prajwol-OptiPlex-3050/ime3dqhKbr-001982"
},
"message": "Key: 'DriveItemInvite.Recipients' Error:Field validation for 'Recipients' failed on the 'len' tag"
}
}
```

The error message seems correct but the format seems kind of odd in long string format. It would be good and readable if the error message is in proper format. Similar message formats can be seen in other invalid requests as well.

## Steps to reproduce
1. user `Alice` creates a resource `textfile.txt`
2. user `Alice` tries to share `textfile.txt` to a multiple group
```
curl -kv -XPOST "https://localhost:9200/graph/v1beta1/drives/{drive-id}/items/{item-id}/invite" -d '{
"recipients": [
{
"@libre.graph.recipient.type": "group",
"objectId": ""
},
{
"@libre.graph.recipient.type": "group",
"objectId": ""
}
],
"roles": [
"1c996275-f1c9-4e71-abdf-a42f6495e960"
]
}' -uAlice:1234
```
cc @fschade

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.