This is an automated email from the git hooks/post-receive script. New commit to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git commit cebcb3153ea10ada6bac0bfc2d0a24adb637138e Author: Benjamin <poussin@codelutin.com> Date: Fri Apr 24 11:21:57 2020 +0200 suppression du cookie user, il est renvoyé dans le body ça suffit correction appel suggest des moteurs de recherche --- pkg/http/opensearchResource.go | 3 ++- pkg/http/userResource.go | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/http/opensearchResource.go b/pkg/http/opensearchResource.go index 8a7e98c..ddb1b7c 100644 --- a/pkg/http/opensearchResource.go +++ b/pkg/http/opensearchResource.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "log" "net/http" + "net/url" "strings" "github.com/gorilla/mux" @@ -157,7 +158,7 @@ func doSuggestion(w http.ResponseWriter, r *http.Request) { if toCall != nil { toCall(w, r, currentUser, actionTodo.Prefix, ask) } else { - uri := strings.ReplaceAll(todo, "{searchTerms}", ask) + uri := strings.ReplaceAll(todo, "{searchTerms}", url.QueryEscape(ask)) log.Println("get suggestion from ", uri) resp, err := http.Get(uri) if err != nil { diff --git a/pkg/http/userResource.go b/pkg/http/userResource.go index c123e79..50518ad 100644 --- a/pkg/http/userResource.go +++ b/pkg/http/userResource.go @@ -6,7 +6,6 @@ import ( "io" "log" "net/http" - "net/url" "time" "github.com/gorilla/mux" @@ -47,7 +46,7 @@ func createAuth(w http.ResponseWriter, r *http.Request) { utils.Throw(w, utils.NewHTTPError500(err, pseudoUser)) return } -log.Println(userJSON) + var user model.BowUser err = json.Unmarshal([]byte(userJSON), &user) if err != nil { @@ -65,8 +64,6 @@ log.Println(userJSON) expiration := time.Now().AddDate(10, 0, 0) // le cookie est valide 10ans :) cookieToken := http.Cookie{Name: constant.Token, Value: token, Path: "/", Expires: expiration, HttpOnly: false} http.SetCookie(w, &cookieToken) - cookieUser := http.Cookie{Name: constant.User, Value: url.PathEscape(userJSON), Path: "/", Expires: expiration, HttpOnly: false} - http.SetCookie(w, &cookieUser) w.Header().Add("Content-Type", "application/json") io.WriteString(w, userJSON) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.