diff options
author | zeripath <art27@cantab.net> | 2019-10-20 23:26:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-20 23:26:36 +0100 |
commit | 28f60bb5cb24c71fdbefe16c2d86943fb4cf8a08 (patch) | |
tree | 5c543277fa4d760dc3086e843adada56cc1ad06d /models/gpg_key.go | |
parent | c8f3146cd52887c0bdd815ad0bdeb954b242c8fc (diff) | |
download | gitea-28f60bb5cb24c71fdbefe16c2d86943fb4cf8a08.tar.gz gitea-28f60bb5cb24c71fdbefe16c2d86943fb4cf8a08.zip |
Ensure default gpg settings not nil and found commits have reference to repo (#8604)
* Ensure defaultGPGSettings not nil
* Ensure that coerced commits gain a reference to the repo
* Add warning if trying to get defaultgpgsetting on an unattached commit
Diffstat (limited to 'models/gpg_key.go')
-rw-r--r-- | models/gpg_key.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/models/gpg_key.go b/models/gpg_key.go index 9b690475bd..58eaa61e22 100644 --- a/models/gpg_key.go +++ b/models/gpg_key.go @@ -682,6 +682,8 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification { defaultGPGSettings, err := c.GetRepositoryDefaultPublicGPGKey(false) if err != nil { log.Error("Error getting default public gpg key: %v", err) + } else if defaultGPGSettings == nil { + log.Warn("Unable to get defaultGPGSettings for unattached commit: %s", c.ID.String()) } else if defaultGPGSettings.Sign { if commitVerification := verifyWithGPGSettings(defaultGPGSettings, sig, c.Signature.Payload, committer, keyID); commitVerification != nil { if commitVerification.Reason == BadSignature { |