aboutsummaryrefslogtreecommitdiffstats
path: root/models/git/commit_status.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/git/commit_status.go')
-rw-r--r--models/git/commit_status.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/models/git/commit_status.go b/models/git/commit_status.go
index 53c5458040..9e7fb5f805 100644
--- a/models/git/commit_status.go
+++ b/models/git/commit_status.go
@@ -281,6 +281,10 @@ func NewCommitStatus(opts NewCommitStatusOptions) error {
return fmt.Errorf("NewCommitStatus[%s, %s]: no user specified", repoPath, opts.SHA)
}
+ if _, err := git.NewIDFromString(opts.SHA); err != nil {
+ return fmt.Errorf("NewCommitStatus[%s, %s]: invalid sha: %w", repoPath, opts.SHA, err)
+ }
+
ctx, committer, err := db.TxContext()
if err != nil {
return fmt.Errorf("NewCommitStatus[repo_id: %d, user_id: %d, sha: %s]: %w", opts.Repo.ID, opts.Creator.ID, opts.SHA, err)