From e3601629c8623721f1e6ff3a2907a9c55d24920c Mon Sep 17 00:00:00 2001 From: Umputun Date: Wed, 7 Mar 2018 22:28:53 -0600 Subject: [PATCH] revert avatar optional encoding --- app/rest/auth/avatar.go | 6 +----- app/rest/auth/providers.go | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/rest/auth/avatar.go b/app/rest/auth/avatar.go index b4014f35..300fd5a4 100644 --- a/app/rest/auth/avatar.go +++ b/app/rest/auth/avatar.go @@ -8,7 +8,6 @@ import ( "net/http" "os" "path" - "strconv" "strings" "time" @@ -54,10 +53,7 @@ func (p *AvatarProxy) Put(u store.User) (avatarURL string, err error) { }() // get ID and location of locally cached avatar - encID := u.ID // all locally created comments have userID encoded hex, imported extra need encoding. - if _, e := strconv.ParseUint(u.ID, 16, 64); e != nil { - encID = rest.EncodeID(u.ID) - } + encID := rest.EncodeID(u.ID) location := p.location(encID) // location adds partion to path if _, err = os.Stat(location); os.IsNotExist(err) { diff --git a/app/rest/auth/providers.go b/app/rest/auth/providers.go index 5b933e2d..b80e37b9 100644 --- a/app/rest/auth/providers.go +++ b/app/rest/auth/providers.go @@ -23,7 +23,7 @@ func NewGoogle(p Params) Provider { Store: p.SessionStore, MapUser: func(data userData, _ []byte) store.User { userInfo := store.User{ - ID: rest.EncodeID("google_" + data.value("email")), + ID: rest.EncodeID("google_" + data.value("email")), // encode email Name: data.value("name"), Picture: data.value("picture"), Profile: data.value("profile"), @@ -47,7 +47,7 @@ func NewGithub(p Params) Provider { Store: p.SessionStore, MapUser: func(data userData, _ []byte) store.User { userInfo := store.User{ - ID: rest.EncodeID("github_" + data.value("login")), + ID: "github_" + data.value("login"), Name: data.value("name"), Picture: data.value("avatar_url"), Profile: data.value("html_url"), @@ -83,7 +83,7 @@ func NewFacebook(p Params) Provider { Store: p.SessionStore, MapUser: func(data userData, bdata []byte) store.User { userInfo := store.User{ - ID: rest.EncodeID("facebook_" + data.value("id")), + ID: "facebook_" + data.value("id"), Name: data.value("name"), } if userInfo.Name == "" {