summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2018-01-28 17:26:01 -0700
committerLauris BH <lauris@nix.lv>2018-01-29 02:26:01 +0200
commit3968c1149ea84506552a0c343f3be8eab2fcfc18 (patch)
treeee5cef7660d42fec134fe20d5e3c3a9eb0a72a8f
parente189b06baa2d6fb0f536452c7e597ad67daa7e85 (diff)
downloadgitea-3968c1149ea84506552a0c343f3be8eab2fcfc18.tar.gz
gitea-3968c1149ea84506552a0c343f3be8eab2fcfc18.zip
Fix SQL type error for webhooks (#3424)
-rw-r--r--models/webhook.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/models/webhook.go b/models/webhook.go
index 3e3f5fc3fd..b18b9e35a3 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -20,6 +20,7 @@ import (
"code.gitea.io/gitea/modules/util"
api "code.gitea.io/sdk/gitea"
+ "github.com/Unknwon/com"
gouuid "github.com/satori/go.uuid"
)
@@ -677,9 +678,15 @@ func DeliverHooks() {
}
// Start listening on new hook requests.
- for repoID := range HookQueue.Queue() {
- log.Trace("DeliverHooks [repo_id: %v]", repoID)
- HookQueue.Remove(repoID)
+ for repoIDStr := range HookQueue.Queue() {
+ log.Trace("DeliverHooks [repo_id: %v]", repoIDStr)
+ HookQueue.Remove(repoIDStr)
+
+ repoID, err := com.StrTo(repoIDStr).Int64()
+ if err != nil {
+ log.Error(4, "Invalid repo ID: %s", repoIDStr)
+ continue
+ }
tasks = make([]*HookTask, 0, 5)
if err := x.Where("repo_id=? AND is_delivered=?", repoID, false).Find(&tasks); err != nil {