mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
chore(backend): rename function for clarity
there's a typo and we now raise 404 on missing file
This commit is contained in:
@@ -77,7 +77,7 @@ func loadTemplate(t *template.Template, path string) *template.Template {
|
||||
return t
|
||||
}
|
||||
|
||||
func serverFileOrEmpty(path string, contentType string, c *gin.Context) {
|
||||
func serveFileOr404(path string, contentType string, c *gin.Context) {
|
||||
if path == "" {
|
||||
c.Data(200, contentType, nil)
|
||||
return
|
||||
|
||||
4
main.go
4
main.go
@@ -88,10 +88,10 @@ func setupRouter(router *gin.Engine) {
|
||||
router.GET(getViewURL("/labelValues.json"), knownLabelValues)
|
||||
|
||||
router.GET(getViewURL("/custom.css"), func(c *gin.Context) {
|
||||
serverFileOrEmpty(config.Config.Custom.CSS, "text/css", c)
|
||||
serveFileOr404(config.Config.Custom.CSS, "text/css", c)
|
||||
})
|
||||
router.GET(getViewURL("/custom.js"), func(c *gin.Context) {
|
||||
serverFileOrEmpty(config.Config.Custom.JS, "application/javascript", c)
|
||||
serveFileOr404(config.Config.Custom.JS, "application/javascript", c)
|
||||
})
|
||||
|
||||
router.NoRoute(notFound)
|
||||
|
||||
Reference in New Issue
Block a user