From a85d91b4bd687622c0f61608df3530d59289d030 Mon Sep 17 00:00:00 2001 From: astaxie Date: Thu, 19 Sep 2013 23:04:05 +0800 Subject: [PATCH] fix #206 --- flash.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flash.go b/flash.go index 8fe8c763..5a670176 100644 --- a/flash.go +++ b/flash.go @@ -6,6 +6,8 @@ import ( "strings" ) +const BEEGO_FLASH_SEP = "#BEEGOFLASH#" + type FlashData struct { Data map[string]string } @@ -44,7 +46,7 @@ func (fd *FlashData) Store(c *Controller) { c.Data["flash"] = fd.Data var flashValue string 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, "/") } @@ -58,7 +60,7 @@ func ReadFromRequest(c *Controller) *FlashData { vals := strings.Split(v, "\x00") for _, v := range vals { if len(v) > 0 { - kv := strings.Split(v, ":") + kv := strings.Split(v, BEEGO_FLASH_SEP) if len(kv) == 2 { flash.Data[kv[0]] = kv[1] }