revert avatar optional encoding

This commit is contained in:
Umputun
2018-03-07 22:28:53 -06:00
parent ac78dde639
commit e3601629c8
2 changed files with 4 additions and 8 deletions
+1 -5
View File
@@ -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) {
+3 -3
View File
@@ -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 == "" {