diff --git a/internal/api/router.go b/internal/api/router.go index e2c6c1a..249b0f0 100644 --- a/internal/api/router.go +++ b/internal/api/router.go @@ -1,7 +1,9 @@ package api import ( + "mime" "net/http" + "path" "github.com/gin-gonic/gin" "github.com/llamalink/llamalink/internal/api/handlers" @@ -84,7 +86,12 @@ func New(cfg *config.Config, db *gorm.DB, llamaManager *llama.Manager) *gin.Engi c.String(http.StatusNotFound, "asset not found") return } - c.Data(http.StatusOK, http.DetectContentType(data), data) + ext := path.Ext(filepath) + contentType := mime.TypeByExtension(ext) + if contentType == "" { + contentType = "application/octet-stream" + } + c.Data(http.StatusOK, contentType, data) }) r.GET("/admin", func(c *gin.Context) { index, err := web.Index()