summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandomChars <random@chars.jp>2021-09-14 20:28:40 +0900
committerRandomChars <random@chars.jp>2021-09-14 20:28:40 +0900
commit5959868fa3535e2617fc713dca27fe9cae8c6653 (patch)
tree5303b2d4fdb37a3e6f8419ca24d6097862902136
parent9c913135609a6ca5952fee3b325478382e4b2078 (diff)
better error logging, fix parent field checking in image updatev1.2.4
-rw-r--r--go.mod2
-rw-r--r--go.sum2
-rw-r--r--recover.go4
-rw-r--r--store/image.go2
4 files changed, 7 insertions, 3 deletions
diff --git a/go.mod b/go.mod
index 3e3cc6f..d395498 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.16
require (
github.com/bwmarrin/snowflake v0.3.0
github.com/fsnotify/fsnotify v1.4.9
- github.com/gin-gonic/gin v1.7.2
+ github.com/gin-gonic/gin v1.7.4
github.com/gopherjs/gopherjs v0.0.0-20210901121439-eee08aaf2717
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/sirupsen/logrus v1.8.1
diff --git a/go.sum b/go.sum
index 4a5bc09..75642a4 100644
--- a/go.sum
+++ b/go.sum
@@ -50,6 +50,8 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/gin-gonic/gin v1.7.2 h1:Tg03T9yM2xa8j6I3Z3oqLaQRSmKvxPd6g/2HJ6zICFA=
github.com/gin-gonic/gin v1.7.2/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
+github.com/gin-gonic/gin v1.7.4 h1:QmUZXrvJ9qZ3GfWvQ+2wnW/1ePrTEJqPKMYEU3lD/DM=
+github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
diff --git a/recover.go b/recover.go
index 7be6fc6..d84c79a 100644
--- a/recover.go
+++ b/recover.go
@@ -4,6 +4,7 @@ import (
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"net/http"
+ "runtime/debug"
)
func recovery() gin.HandlerFunc {
@@ -13,8 +14,9 @@ func recovery() gin.HandlerFunc {
if p != nil {
log.Errorf("Panic occurred in web server, %s", p)
context.JSON(http.StatusInternalServerError, gin.H{
- "error": p,
+ "error": "panic",
})
+ log.Error(string(debug.Stack()))
}
}()
context.Next()
diff --git a/store/image.go b/store/image.go
index 22b76b5..ddf5a82 100644
--- a/store/image.go
+++ b/store/image.go
@@ -310,7 +310,7 @@ func (s *Store) ImageUpdate(hash, source, parent, commentary, commentaryTranslat
info.Source = source
msg += "source"
}
- if parent != "\000" {
+ if parent != "\000" && parent != "" {
if p := s.ImageSnowflake(parent); p.Snowflake == parent {
s.getLock(p.Hash).Lock()
defer s.getLock(p.Hash).Unlock()