From db681c6f2d2490cfa7bf8b3556aa4c139fe79906 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 13:04:40 +0000 Subject: [PATCH 1/5] Bump github.com/BurntSushi/toml from 0.4.1 to 1.0.0 Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 0.4.1 to 1.0.0. - [Release notes](https://github.com/BurntSushi/toml/releases) - [Commits](https://github.com/BurntSushi/toml/compare/v0.4.1...v1.0.0) --- updated-dependencies: - dependency-name: github.com/BurntSushi/toml dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index c47079ad9..c5ff8cdd7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/gobuffalo/buffalo go 1.16 require ( - github.com/BurntSushi/toml v0.4.1 + github.com/BurntSushi/toml v1.0.0 github.com/dustin/go-humanize v1.0.0 github.com/fatih/color v1.13.0 github.com/gobuffalo/envy v1.10.1 diff --git a/go.sum b/go.sum index 4cdb4a5f3..469748382 100644 --- a/go.sum +++ b/go.sum @@ -48,8 +48,9 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU= +github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= From 32a289364e9aff4a3064d8097521f406d276c340 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 17:30:20 +0000 Subject: [PATCH 2/5] Bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7e09bfbe5..661129f85 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ jobs: - "ubuntu-latest" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Go ${{ matrix.go }} uses: actions/setup-go@v2 with: From dfd96dae86612a12cdbd74c50b997ccf32d998ee Mon Sep 17 00:00:00 2001 From: Antonio Pagano Date: Sat, 5 Mar 2022 12:46:12 -0500 Subject: [PATCH 3/5] task: fixing #221,flash being cleared on redirect --- default_context.go | 1 - flash_test.go | 29 ++++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/default_context.go b/default_context.go index 0aad92404..3f2eec99d 100644 --- a/default_context.go +++ b/default_context.go @@ -195,7 +195,6 @@ var mapType = reflect.ValueOf(map[string]interface{}{}).Type() // Redirect a request with the given status to the given URL. func (d *DefaultContext) Redirect(status int, url string, args ...interface{}) error { if d.Session() != nil { - d.Flash().Clear() d.Flash().persist(d.Session()) if err := d.Session().Save(); err != nil { return HTTPError{Status: http.StatusInternalServerError, Cause: err} diff --git a/flash_test.go b/flash_test.go index 25f863f47..bd3edb86a 100644 --- a/flash_test.go +++ b/flash_test.go @@ -3,6 +3,7 @@ package buffalo import ( "net/http" "testing" + "text/template" "github.com/gobuffalo/buffalo/render" "github.com/gobuffalo/httptest" @@ -120,4 +121,30 @@ func Test_FlashRenderCustomKeyNotDefined(t *testing.T) { const customKeyTPL = ` {{#each flash.other as |k value|}} {{value}} - {{/each}}` + {{/each}} +` + +func Test_FlashNotClearedOnRedirect(t *testing.T) { + r := require.New(t) + a := New(Options{}) + rr := render.New(render.Options{}) + + a.GET("/flash", func(c Context) error { + c.Flash().Add("success", "Antonio, you're welcome!") + return c.Redirect(http.StatusSeeOther, "/") + }) + + a.GET("/", func(c Context) error { + template := `Message: <%= flash["success"] %>` + return c.Render(http.StatusCreated, rr.String(template)) + }) + + w := httptest.New(a) + res := w.HTML("/flash").Get() + r.Equal(res.Code, http.StatusSeeOther) + r.Equal(res.Location(), "/") + + res = w.HTML("/").Get() + r.Contains(res.Body.String(), template.HTMLEscapeString("Antonio, you're welcome!")) + +} From 8e715969fdafcb02f520572410699a3a4e88d9d5 Mon Sep 17 00:00:00 2001 From: Antonio Pagano Date: Sat, 5 Mar 2022 12:47:40 -0500 Subject: [PATCH 4/5] adding comment for the embed underscore import --- error_templates.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/error_templates.go b/error_templates.go index 2fb4d13d9..6ebbb3983 100644 --- a/error_templates.go +++ b/error_templates.go @@ -1,7 +1,7 @@ package buffalo import ( - _ "embed" + _ "embed" // needed to embed the templates. ) var ( From f301d060eeeba5e65ef0868e55f4621a4b423e15 Mon Sep 17 00:00:00 2001 From: Antonio Pagano Date: Tue, 8 Mar 2022 17:13:33 -0500 Subject: [PATCH 5/5] updating version --- runtime/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/version.go b/runtime/version.go index 4bf2cc5c1..2f9316adb 100644 --- a/runtime/version.go +++ b/runtime/version.go @@ -1,4 +1,4 @@ package runtime // Version is the current version of the buffalo binary -var Version = "v0.18.3" +var Version = "v0.18.4"