From 899ab31fff9b34bc125faf75b79a89e390deb2cf Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 1 Sep 2017 09:00:27 -0400 Subject: Implement experimental REST API endpoints for plugins (#7279) * Implement experimental REST API endpoints for plugins * Updates per feedback and rebase * Update tests * Further updates * Update extraction of plugins * Use OS temp dir for plugins instead of search path * Fail extraction on paths that attempt to traverse upward * Update pluginenv ActivePlugins() --- api4/context.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'api4/context.go') diff --git a/api4/context.go b/api4/context.go index 3ea67b30c..2c0e54ea0 100644 --- a/api4/context.go +++ b/api4/context.go @@ -428,6 +428,18 @@ func (c *Context) RequireFileId() *Context { return c } +func (c *Context) RequirePluginId() *Context { + if c.Err != nil { + return c + } + + if len(c.Params.PluginId) == 0 { + c.SetInvalidUrlParam("plugin_id") + } + + return c +} + func (c *Context) RequireReportId() *Context { if c.Err != nil { return c -- cgit v1.2.3-1-g7c22