mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 02:42:39 +08:00
Plugins: Add Plugin FS abstraction (#63734)
* unexport pluginDir from dto * first pass * tidy * naming + add mutex * add dupe checking * fix func typo * interface + move logic from renderer * remote finder * remote signing * fix tests * tidy up * tidy markdown logic * split changes * fix tests * slim interface down * fix status code * tidy exec path func * fixup * undo changes * remove unused func * remove unused func * fix goimports * fetch remotely * simultaneous support * fix linter * use var * add exception for gosec warning * fixup * fix tests * tidy * rework cfg pattern * simplify * PR feedback * fix dupe field * remove g304 nolint * apply PR feedback * remove unnecessary gosec nolint * fix finder loop and update comment * fix map alloc * fix test * remove commented code
This commit is contained in:
@ -271,17 +271,20 @@ func (hs *HTTPServer) GetPluginMarkdown(c *contextmodel.ReqContext) response.Res
|
||||
if err != nil {
|
||||
var notFound plugins.NotFoundError
|
||||
if errors.As(err, ¬Found) {
|
||||
return response.Error(404, notFound.Error(), nil)
|
||||
return response.Error(http.StatusNotFound, notFound.Error(), nil)
|
||||
}
|
||||
|
||||
return response.Error(500, "Could not get markdown file", err)
|
||||
return response.Error(http.StatusInternalServerError, "Could not get markdown file", err)
|
||||
}
|
||||
|
||||
// fallback try readme
|
||||
if len(content) == 0 {
|
||||
content, err = hs.pluginMarkdown(c.Req.Context(), pluginID, "readme")
|
||||
if err != nil {
|
||||
return response.Error(501, "Could not get markdown file", err)
|
||||
if errors.Is(err, plugins.ErrFileNotExist) {
|
||||
return response.Error(http.StatusNotFound, plugins.ErrFileNotExist.Error(), nil)
|
||||
}
|
||||
return response.Error(http.StatusNotImplemented, "Could not get markdown file", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user