From e7749ea250c5d28d0ad2ef873ff615b91e59cb95 Mon Sep 17 00:00:00 2001 From: joeybloggs Date: Tue, 23 Feb 2016 15:26:02 -0500 Subject: [PATCH] Update validations for "url" and "uri" because of Go 1.6 changes added checks for blank and fragment/suffix because of Go 1.6 change https://github.com/golang/go/commit/617c93ce740c3c3cc28cdd1a0d712be183d0b328#diff-6c2d018290e298803c0c9419d8739885L195 fix was to emulate browser and strip the '#' suffix prior to validation. see #237 --- baked_in.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/baked_in.go b/baked_in.go index 4871456..3dcb0de 100644 --- a/baked_in.go +++ b/baked_in.go @@ -748,7 +748,7 @@ func IsURI(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Va s := field.String() - // checks needed as of Go 1.6 becuase of change https://github.com/golang/go/commit/617c93ce740c3c3cc28cdd1a0d712be183d0b328#diff-6c2d018290e298803c0c9419d8739885L195 + // checks needed as of Go 1.6 because of change https://github.com/golang/go/commit/617c93ce740c3c3cc28cdd1a0d712be183d0b328#diff-6c2d018290e298803c0c9419d8739885L195 // emulate browser and strip the '#' suffix prior to validation. see issue-#237 if i := strings.Index(s, "#"); i > -1 { s = s[:i] @@ -777,7 +777,7 @@ func IsURL(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Va var i int s := field.String() - // checks needed as of Go 1.6 becuase of change https://github.com/golang/go/commit/617c93ce740c3c3cc28cdd1a0d712be183d0b328#diff-6c2d018290e298803c0c9419d8739885L195 + // checks needed as of Go 1.6 because of change https://github.com/golang/go/commit/617c93ce740c3c3cc28cdd1a0d712be183d0b328#diff-6c2d018290e298803c0c9419d8739885L195 // emulate browser and strip the '#' suffix prior to validation. see issue-#237 if i = strings.Index(s, "#"); i > -1 { s = s[:i]