fix: issue with plugins not downloading
This commit is contained in:
parent
135245ca9c
commit
f917d2b6f8
1 changed files with 4 additions and 3 deletions
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
makeshift "git.towk2.me/towk/makeshift/pkg"
|
makeshift "git.towk2.me/towk/makeshift/pkg"
|
||||||
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Service) ListPlugins() http.HandlerFunc {
|
func (s *Service) ListPlugins() http.HandlerFunc {
|
||||||
|
|
@ -42,13 +42,14 @@ func (s *Service) ListPlugins() http.HandlerFunc {
|
||||||
func (s *Service) GetPlugin() http.HandlerFunc {
|
func (s *Service) GetPlugin() http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var (
|
var (
|
||||||
pluginName = strings.TrimPrefix(r.URL.Path, "/plugin")
|
pluginName = chi.URLParam(r, "name")
|
||||||
|
path = s.PathForPluginWithName(pluginName)
|
||||||
plugin makeshift.Plugin
|
plugin makeshift.Plugin
|
||||||
body []byte
|
body []byte
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
plugin, err = LoadPluginFromFile(pluginName)
|
plugin, err = LoadPluginFromFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue