Skip to content
Snippets Groups Projects
Commit 5959868f authored by Ophestra's avatar Ophestra
Browse files

better error logging, fix parent field checking in image update

parent 9c913135
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ go 1.16 ...@@ -5,7 +5,7 @@ go 1.16
require ( require (
github.com/bwmarrin/snowflake v0.3.0 github.com/bwmarrin/snowflake v0.3.0
github.com/fsnotify/fsnotify v1.4.9 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/gopherjs/gopherjs v0.0.0-20210901121439-eee08aaf2717
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/sirupsen/logrus v1.8.1 github.com/sirupsen/logrus v1.8.1
......
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"net/http" "net/http"
"runtime/debug"
) )
func recovery() gin.HandlerFunc { func recovery() gin.HandlerFunc {
...@@ -13,8 +14,9 @@ func recovery() gin.HandlerFunc { ...@@ -13,8 +14,9 @@ func recovery() gin.HandlerFunc {
if p != nil { if p != nil {
log.Errorf("Panic occurred in web server, %s", p) log.Errorf("Panic occurred in web server, %s", p)
context.JSON(http.StatusInternalServerError, gin.H{ context.JSON(http.StatusInternalServerError, gin.H{
"error": p, "error": "panic",
}) })
log.Error(string(debug.Stack()))
} }
}() }()
context.Next() context.Next()
......
...@@ -310,7 +310,7 @@ func (s *Store) ImageUpdate(hash, source, parent, commentary, commentaryTranslat ...@@ -310,7 +310,7 @@ func (s *Store) ImageUpdate(hash, source, parent, commentary, commentaryTranslat
info.Source = source info.Source = source
msg += "source" msg += "source"
} }
if parent != "\000" { if parent != "\000" && parent != "" {
if p := s.ImageSnowflake(parent); p.Snowflake == parent { if p := s.ImageSnowflake(parent); p.Snowflake == parent {
s.getLock(p.Hash).Lock() s.getLock(p.Hash).Lock()
defer s.getLock(p.Hash).Unlock() defer s.getLock(p.Hash).Unlock()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment