• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gameap / gameap / 29643501158

18 Jul 2026 11:58AM UTC coverage: 82.161% (-0.05%) from 82.208%
29643501158

push

github

et-nik
plugin icon

43 of 82 new or added lines in 5 files covered. (52.44%)

7 existing lines in 3 files now uncovered.

47090 of 57314 relevant lines covered (82.16%)

34909.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.21
/internal/api/pluginstore/getpluginicon/handler.go
1
package getpluginicon
2

3
import (
4
        "net/http"
5
        "strconv"
6

7
        "github.com/gameap/gameap/internal/api/base"
8
        "github.com/gameap/gameap/internal/api/filemanager/filemanagerhttp"
9
        "github.com/gameap/gameap/internal/services/pluginstore"
10
        "github.com/gameap/gameap/pkg/api"
11
        "github.com/pkg/errors"
12
)
13

14
type Handler struct {
15
        storeService *pluginstore.Service
16
        responder    base.Responder
17
}
18

19
func NewHandler(storeService *pluginstore.Service, responder base.Responder) *Handler {
7✔
20
        return &Handler{
7✔
21
                storeService: storeService,
7✔
22
                responder:    responder,
7✔
23
        }
7✔
24
}
7✔
25

26
func (h *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
8✔
27
        ctx := r.Context()
8✔
28

8✔
29
        pluginID, err := api.NewInputReader(r).ReadString("id")
8✔
30
        if err != nil {
8✔
NEW
31
                h.responder.WriteError(ctx, rw, errors.WithMessage(err, "failed to read plugin ID"))
×
NEW
32

×
NEW
33
                return
×
NEW
34
        }
×
35

36
        icon, err := h.storeService.GetPluginIcon(ctx, pluginID)
8✔
37
        if err != nil {
10✔
38
                h.responder.WriteError(ctx, rw, errors.WithMessage(err, "failed to get plugin icon from store"))
2✔
39

2✔
40
                return
2✔
41
        }
2✔
42

43
        filemanagerhttp.SafeContentHeaders(rw.Header(), pluginID+"-icon", icon.ContentType)
6✔
44
        rw.Header().Set("Cache-Control", "private, max-age=3600")
6✔
45
        rw.Header().Set("Content-Length", strconv.Itoa(len(icon.Data)))
6✔
46
        rw.WriteHeader(http.StatusOK)
6✔
47
        //nolint:gosec // G705: SafeContentHeaders restricts Content-Type to inert
6✔
48
        // types (or forces an attachment) and sets nosniff + CSP sandbox, so the
6✔
49
        // proxied bytes cannot execute in the panel origin.
6✔
50
        _, _ = rw.Write(icon.Data)
6✔
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc