mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
middlware: prevent orgredirect to open body stream
the org redirecter opened the body stream by misstake. Causing downstream code to start reading from an empty stream and raise errors.
This commit is contained in:
parent
b176f36889
commit
072c1559ba
@ -2,6 +2,7 @@ package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
@ -11,8 +12,10 @@ import (
|
||||
|
||||
func OrgRedirect() macaron.Handler {
|
||||
return func(res http.ResponseWriter, req *http.Request, c *macaron.Context) {
|
||||
orgId := c.QueryInt64("orgId")
|
||||
if orgId == 0 {
|
||||
orgIdValue := req.URL.Query().Get("orgId")
|
||||
orgId, err := strconv.ParseInt(orgIdValue, 10, 32)
|
||||
|
||||
if err != nil || orgId == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user