Skip to content

Commit 621c4e3

Browse files
authored
Fix a panic for invalid sharing (#4459)
2 parents 4a7c868 + 833f23a commit 621c4e3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

model/sharing/member.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ func (s *Sharing) DelegateDiscovery(inst *instance.Instance, state, cozyURL stri
461461
v.Add("state", state)
462462
v.Add("url", cozyURL)
463463
body := []byte(v.Encode())
464+
if len(s.Credentials) == 0 {
465+
return "", ErrInvalidSharing
466+
}
464467
c := &s.Credentials[0]
465468
opts := &request.Options{
466469
Method: http.MethodPost,

0 commit comments

Comments
 (0)