Commit a85d91b4 authored by astaxie's avatar astaxie

fix #206

parent a616087c
...@@ -6,6 +6,8 @@ import ( ...@@ -6,6 +6,8 @@ import (
"strings" "strings"
) )
const BEEGO_FLASH_SEP = "#BEEGOFLASH#"
type FlashData struct { type FlashData struct {
Data map[string]string Data map[string]string
} }
...@@ -44,7 +46,7 @@ func (fd *FlashData) Store(c *Controller) { ...@@ -44,7 +46,7 @@ func (fd *FlashData) Store(c *Controller) {
c.Data["flash"] = fd.Data c.Data["flash"] = fd.Data
var flashValue string var flashValue string
for key, value := range fd.Data { for key, value := range fd.Data {
flashValue += "\x00" + key + ":" + value + "\x00" flashValue += "\x00" + key + BEEGO_FLASH_SEP + value + "\x00"
} }
c.Ctx.SetCookie("BEEGO_FLASH", url.QueryEscape(flashValue), 0, "/") c.Ctx.SetCookie("BEEGO_FLASH", url.QueryEscape(flashValue), 0, "/")
} }
...@@ -58,7 +60,7 @@ func ReadFromRequest(c *Controller) *FlashData { ...@@ -58,7 +60,7 @@ func ReadFromRequest(c *Controller) *FlashData {
vals := strings.Split(v, "\x00") vals := strings.Split(v, "\x00")
for _, v := range vals { for _, v := range vals {
if len(v) > 0 { if len(v) > 0 {
kv := strings.Split(v, ":") kv := strings.Split(v, BEEGO_FLASH_SEP)
if len(kv) == 2 { if len(kv) == 2 {
flash.Data[kv[0]] = kv[1] flash.Data[kv[0]] = kv[1]
} }
......
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