Improve comments and error message.

pull/42838/head v8.3.1
Sofia Papagiannaki 4 years ago committed by GitHub
parent 00e38ba555
commit b98c51cbe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      pkg/api/plugins.go

@ -281,11 +281,12 @@ func (hs *HTTPServer) getPluginAssets(c *models.ReqContext) {
return
}
// prepend slash for cleaning relative paths
requestedFile := filepath.Clean(filepath.Join("/", web.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
}

Loading…
Cancel
Save