From 5636d5145a07c05d88f2e9b5d08ecb6a694c3821 Mon Sep 17 00:00:00 2001 From: Antonio Pagano <645522+paganotoni@users.noreply.github.com> Date: Thu, 16 Jul 2020 17:34:03 -0500 Subject: [PATCH] v0.16.12 (#2017) * adding direct version on the docker build * fixing plugin installation * Fix npm's package.json permissions (#2005) Changed created file permissions from 644 (`-w----r--`) to 0644 (`rw-r--r--`) * Bump spf13/viper to v1.7.0 (#1999) * bunping version * changing version on dockerfile * patch to fix the keywords check on new app * removing unneeded append * Task fixing html binder (#2016) * binder was not wired * packing * adding new version number Co-authored-by: Disconnect3d Co-authored-by: hackerman <3372410+aeneasr@users.noreply.github.com> --- Dockerfile.build | 4 ++-- Dockerfile.slim.build | 4 ++-- binding/binding.go | 6 ++---- binding/html_content_type_binder.go | 13 +++++++------ runtime/version.go | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Dockerfile.build b/Dockerfile.build index b74bea99d..12a48cd28 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -33,8 +33,8 @@ RUN npm install -g --no-progress yarn \ RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0 # Pulling docker binary from releases -RUN wget https://github.com/gobuffalo/buffalo/releases/download/v0.16.11/buffalo_0.16.11_Linux_x86_64.tar.gz \ - && tar -xzf buffalo_0.16.11_Linux_x86_64.tar.gz \ +RUN wget https://github.com/gobuffalo/buffalo/releases/download/v0.16.12/buffalo_0.16.12_Linux_x86_64.tar.gz \ + && tar -xzf buffalo_0.16.12_Linux_x86_64.tar.gz \ && mv buffalo $(go env GOPATH)/bin/buffalo RUN go get github.com/gobuffalo/buffalo-pop/v2 diff --git a/Dockerfile.slim.build b/Dockerfile.slim.build index 8d9e323b0..6f14ba0ea 100644 --- a/Dockerfile.slim.build +++ b/Dockerfile.slim.build @@ -19,8 +19,8 @@ RUN npm i -g --no-progress yarn \ && yarn config set yarn-offline-mirror-pruning true # Pulling docker binary from releases -RUN wget https://github.com/gobuffalo/buffalo/releases/download/v0.16.11/buffalo_v0.16.11_Linux_x86_64.tar.gz \ - && tar -xzf buffalo_v0.16.11_Linux_x86_64.tar.gz \ +RUN wget https://github.com/gobuffalo/buffalo/releases/download/v0.16.12/buffalo_v0.16.12_Linux_x86_64.tar.gz \ + && tar -xzf buffalo_v0.16.12_Linux_x86_64.tar.gz \ && mv buffalo $(go env GOPATH)/bin/buffalo RUN go get github.com/gobuffalo/buffalo-pop/v2 diff --git a/binding/binding.go b/binding/binding.go index 88e0c9999..e77eb6974 100644 --- a/binding/binding.go +++ b/binding/binding.go @@ -19,13 +19,11 @@ var ( IgnoreUnknownKeys: true, }) - // BaseRequestBinder is an instance of the requeBinder, it comes with preconfigured + // BaseRequestBinder is an instance of the requestBinder, it comes with preconfigured // content type binders for HTML, JSON, XML and Files, as well as custom types decoders // for time.Time and nulls.Time BaseRequestBinder = NewRequestBinder( - HTMLContentTypeBinder{ - decoder: formDecoder, - }, + NewHTMLContentTypeBinder(formDecoder), JSONContentTypeBinder{}, XMLRequestTypeBinder{}, FileRequestTypeBinder{ diff --git a/binding/html_content_type_binder.go b/binding/html_content_type_binder.go index 06b5ec97c..0450bc48d 100644 --- a/binding/html_content_type_binder.go +++ b/binding/html_content_type_binder.go @@ -2,8 +2,10 @@ package binding import ( "net/http" + "time" "github.com/gobuffalo/buffalo/binding/decoders" + "github.com/gobuffalo/nulls" "github.com/monoculum/formam" ) @@ -15,14 +17,12 @@ type HTMLContentTypeBinder struct { // NewHTMLContentTypeBinder returns an instance of HTMLContentTypeBinder with // custom type decoders registered for Time and nulls.Time func NewHTMLContentTypeBinder(decoder *formam.Decoder) HTMLContentTypeBinder { - htmlBinder := HTMLContentTypeBinder{ + decoder.RegisterCustomType(decoders.TimeDecoderFn(), []interface{}{time.Time{}}, nil) + decoder.RegisterCustomType(decoders.NullTimeDecoderFn(), []interface{}{nulls.Time{}}, nil) + + return HTMLContentTypeBinder{ decoder: decoder, } - - decoder.RegisterCustomType(decoders.TimeDecoderFn(), []interface{}{}, []interface{}{}) - decoder.RegisterCustomType(decoders.NullTimeDecoderFn(), []interface{}{}, []interface{}{}) - - return htmlBinder } // ContentTypes that will be used to identify HTML requests @@ -46,6 +46,7 @@ func (ht HTMLContentTypeBinder) BinderFunc() Binder { if err := ht.decoder.Decode(req.Form, i); err != nil { return err } + return nil } } diff --git a/runtime/version.go b/runtime/version.go index d9f4664d6..05362ddad 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.16.11" +var Version = "v0.16.12"