Commit 1532eb42 by Torkel Ödegaard

Fixed png rendering

parent ed879df1
Subproject commit 984ece646f831678c5a8f32e4a69f54fdad914c4
Subproject commit 64f98d2409152a2bfa34b6f032d21e6bb18b97f8
......@@ -12,7 +12,7 @@ import (
func RenderToPng(c *middleware.Context) {
accountId := c.UsingAccountId
queryReader := util.NewUrlQueryReader(c.Req.URL)
queryParams := "?render&accountId=" + strconv.FormatInt(accountId, 10) + "&" + c.Req.URL.RawQuery
queryParams := "?render=1&accountId=" + strconv.FormatInt(accountId, 10) + "&" + c.Req.URL.RawQuery
renderOpts := &renderer.RenderOpts{
Url: c.Params("*") + queryParams,
......
package middleware
import (
"strconv"
"strings"
"github.com/Unknwon/macaron"
......@@ -22,12 +21,11 @@ func getRequestAccountId(c *Context) int64 {
return accountId.(int64)
}
// localhost render query
urlQuery := c.Req.URL.Query()
if len(urlQuery["render"]) > 0 {
accId, _ := strconv.ParseInt(urlQuery["accountId"][0], 10, 64)
c.Session.Set("accountId", accId)
accountId = accId
// TODO: figure out a way to secure this
if c.Query("render") == "1" {
accountId := c.QueryInt64("accountId")
c.Session.Set("accountId", accountId)
return accountId
}
return 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment