Chore: pass url parameters through context.Context (#38826)

* pass url parameters through context.Context

* fix url param names without colon prefix

* change context params to vars

* replace url vars in tests using new api

* rename vars to params

* add some comments

* rename seturlvars to seturlparams
This commit is contained in:
Serge Zaitsev
2021-09-14 19:34:56 +03:00
committed by GitHub
parent fb1c31e1b6
commit 063160aae2
41 changed files with 177 additions and 158 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
macaron "gopkg.in/macaron.v1"
)
// createShortURL handles requests to create short URLs.
@@ -45,7 +46,7 @@ func (hs *HTTPServer) createShortURL(c *models.ReqContext, cmd dtos.CreateShortU
}
func (hs *HTTPServer) redirectFromShortURL(c *models.ReqContext) {
shortURLUID := c.Params(":uid")
shortURLUID := macaron.Params(c.Req)[":uid"]
if !util.IsValidShortUID(shortURLUID) {
return