fix #206
Showing
1 changed file
with
4 additions
and
2 deletions
| ... | @@ -6,6 +6,8 @@ import ( | ... | @@ -6,6 +6,8 @@ import ( |
| 6 | "strings" | 6 | "strings" |
| 7 | ) | 7 | ) |
| 8 | 8 | ||
| 9 | const BEEGO_FLASH_SEP = "#BEEGOFLASH#" | ||
| 10 | |||
| 9 | type FlashData struct { | 11 | type FlashData struct { |
| 10 | Data map[string]string | 12 | Data map[string]string |
| 11 | } | 13 | } |
| ... | @@ -44,7 +46,7 @@ func (fd *FlashData) Store(c *Controller) { | ... | @@ -44,7 +46,7 @@ func (fd *FlashData) Store(c *Controller) { |
| 44 | c.Data["flash"] = fd.Data | 46 | c.Data["flash"] = fd.Data |
| 45 | var flashValue string | 47 | var flashValue string |
| 46 | for key, value := range fd.Data { | 48 | for key, value := range fd.Data { |
| 47 | flashValue += "\x00" + key + ":" + value + "\x00" | 49 | flashValue += "\x00" + key + BEEGO_FLASH_SEP + value + "\x00" |
| 48 | } | 50 | } |
| 49 | c.Ctx.SetCookie("BEEGO_FLASH", url.QueryEscape(flashValue), 0, "/") | 51 | c.Ctx.SetCookie("BEEGO_FLASH", url.QueryEscape(flashValue), 0, "/") |
| 50 | } | 52 | } |
| ... | @@ -58,7 +60,7 @@ func ReadFromRequest(c *Controller) *FlashData { | ... | @@ -58,7 +60,7 @@ func ReadFromRequest(c *Controller) *FlashData { |
| 58 | vals := strings.Split(v, "\x00") | 60 | vals := strings.Split(v, "\x00") |
| 59 | for _, v := range vals { | 61 | for _, v := range vals { |
| 60 | if len(v) > 0 { | 62 | if len(v) > 0 { |
| 61 | kv := strings.Split(v, ":") | 63 | kv := strings.Split(v, BEEGO_FLASH_SEP) |
| 62 | if len(kv) == 2 { | 64 | if len(kv) == 2 { |
| 63 | flash.Data[kv[0]] = kv[1] | 65 | flash.Data[kv[0]] = kv[1] |
| 64 | } | 66 | } | ... | ... |
-
Please register or sign in to post a comment