fix: issue with plugins not downloading

This commit is contained in:
David Allen 2025-08-29 16:24:40 -06:00
parent 135245ca9c
commit f917d2b6f8
Signed by: towk
GPG key ID: 0430CDBE22619155

View file

@ -5,9 +5,9 @@ import (
"io"
"net/http"
"os"
"strings"
makeshift "git.towk2.me/towk/makeshift/pkg"
"github.com/go-chi/chi/v5"
)
func (s *Service) ListPlugins() http.HandlerFunc {
@ -42,13 +42,14 @@ func (s *Service) ListPlugins() http.HandlerFunc {
func (s *Service) GetPlugin() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var (
pluginName = strings.TrimPrefix(r.URL.Path, "/plugin")
pluginName = chi.URLParam(r, "name")
path = s.PathForPluginWithName(pluginName)
plugin makeshift.Plugin
body []byte
err error
)
plugin, err = LoadPluginFromFile(pluginName)
plugin, err = LoadPluginFromFile(path)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return