Make badgeNone usable in HTML img tag (returning 200 instead of 404)
Also adds a print in the log about the kind of failure
This commit is contained in:
parent
35e5435400
commit
578f73c791
1 changed files with 4 additions and 2 deletions
|
@ -2,6 +2,7 @@ package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
|
@ -42,7 +43,8 @@ func GetBadge(c *gin.Context) {
|
||||||
|
|
||||||
build, err := store.GetBuildLast(c, repo, branch)
|
build, err := store.GetBuildLast(c, repo, branch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.String(404, badgeNone)
|
log.Println(err)
|
||||||
|
c.String(200, badgeNone)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +58,7 @@ func GetBadge(c *gin.Context) {
|
||||||
case model.StatusPending, model.StatusRunning:
|
case model.StatusPending, model.StatusRunning:
|
||||||
c.String(200, badgeStarted)
|
c.String(200, badgeStarted)
|
||||||
default:
|
default:
|
||||||
c.String(404, badgeNone)
|
c.String(200, badgeNone)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue