MCPcopy
hub / github.com/gotify/server / serveFile

Function serveFile

ui/serve.go:50–60  ·  view source on GitHub ↗
(name, contentType string, convert func(string) string)

Source from the content-addressed store, hash-verified

48}
49
50func serveFile(name, contentType string, convert func(string) string) gin.HandlerFunc {
51 content, err := box.ReadFile("build/" + name)
52 if err != nil {
53 panic(err)
54 }
55 converted := convert(string(content))
56 return func(ctx *gin.Context) {
57 ctx.Header("Content-Type", contentType)
58 ctx.String(200, converted)
59 }
60}

Callers 1

RegisterFunction · 0.85

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…