Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Fix 440: Remove writing plugins to autodiscover directory from REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
geauxvirtual committed Oct 26, 2015
1 parent 5a039aa commit 8ac927f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions mgmt/rest/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (s *Server) loadPlugin(w http.ResponseWriter, r *http.Request, _ httprouter
return
}
}
files[i], err = writeFile(s.mm.GetAutodiscoverPaths(), p.FileName(), b)
files[i], err = writeFile(p.FileName(), b)
if err != nil {
respond(500, rbody.FromError(err), w)
return
Expand Down Expand Up @@ -142,16 +142,12 @@ func (s *Server) loadPlugin(w http.ResponseWriter, r *http.Request, _ httprouter
}
}

func writeFile(autoPaths []string, filename string, b []byte) (string, error) {
func writeFile(filename string, b []byte) (string, error) {
// Create temporary directory
dir, err := ioutil.TempDir("", "")
if err != nil {
return "", err
}
if len(autoPaths) > 0 {
// write to first autoPath
dir = autoPaths[0]
}
f, err := os.Create(path.Join(dir, filename))
if err != nil {
return "", err
Expand Down

0 comments on commit 8ac927f

Please sign in to comment.