Improve comments and error message.
This commit is contained in:
+3
-2
@@ -264,11 +264,12 @@ func (hs *HTTPServer) getPluginAssets(c *models.ReqContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prepend slash for cleaning relative paths
|
||||||
requestedFile := filepath.Clean(filepath.Join("/",macaron.Params(c.Req)["*"]))
|
requestedFile := filepath.Clean(filepath.Join("/",macaron.Params(c.Req)["*"]))
|
||||||
rel, err := filepath.Rel("/", requestedFile)
|
rel, err := filepath.Rel("/", requestedFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// this should not never fail
|
// slash is prepended above therefore this is not expected to fail
|
||||||
c.JsonApiErr(500, "Relative path found", err)
|
c.JsonApiErr(500, "Failed to get the relative path", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user