diff --git a/pkg/api/plugins.go b/pkg/api/plugins.go index 656c5973691..b62ea85fac5 100644 --- a/pkg/api/plugins.go +++ b/pkg/api/plugins.go @@ -264,11 +264,12 @@ func (hs *HTTPServer) getPluginAssets(c *models.ReqContext) { return } + // prepend slash for cleaning relative paths requestedFile := filepath.Clean(filepath.Join("/",macaron.Params(c.Req)["*"])) rel, err := filepath.Rel("/", requestedFile) if err != nil { - // this should not never fail - c.JsonApiErr(500, "Relative path found", err) + // slash is prepended above therefore this is not expected to fail + c.JsonApiErr(500, "Failed to get the relative path", err) return }