blob: cbbbd7778579f49c253cbe01dcfb975dbd7cd89a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package wiki
import (
"fmt"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
type requestWithCommitDetails interface {
GetCommitDetails() *gitalypb.WikiCommitDetails
}
func validateRequestCommitDetails(request requestWithCommitDetails) error {
commitDetails := request.GetCommitDetails()
if commitDetails == nil {
return fmt.Errorf("empty CommitDetails")
}
if len(commitDetails.GetName()) == 0 {
return fmt.Errorf("empty CommitDetails.Name")
}
if len(commitDetails.GetEmail()) == 0 {
return fmt.Errorf("empty CommitDetails.Email")
}
if len(commitDetails.GetMessage()) == 0 {
return fmt.Errorf("empty CommitDetails.Message")
}
return nil
}
|