From 91bab801aad337f2353cd4a46c896dfff6714cdf Mon Sep 17 00:00:00 2001 From: Unknwon Date: Mon, 11 Jan 2016 14:34:32 +0800 Subject: [PATCH] #2349 try to handle []int8 case --- README.md | 2 +- conf/locale/TRANSLATORS | 1 + gogs.go | 2 +- models/login.go | 13 ++++++++++++- templates/.VERSION | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ba3ad35af8..3c6aa419ae 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) -##### Current version: 0.8.18 +##### Current version: 0.8.19 | Web | UI | Preview | |:-------------:|:-------:|:-------:| diff --git a/conf/locale/TRANSLATORS b/conf/locale/TRANSLATORS index 2ada4a6138..27c1802db7 100644 --- a/conf/locale/TRANSLATORS +++ b/conf/locale/TRANSLATORS @@ -9,6 +9,7 @@ Aleksey Tarakin Alexander Steinhöfer Alexandre Magno Andrey Nering +Andrey Solomatin Arthur Aslanyan Barış Arda Yılmaz Christoph Kisfeld diff --git a/gogs.go b/gogs.go index 006a272ed1..38f949d36c 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.8.18.0109" +const APP_VER = "0.8.19.0111" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/login.go b/models/login.go index e36171a342..dc620e1bca 100644 --- a/models/login.go +++ b/models/login.go @@ -105,10 +105,21 @@ type LoginSource struct { Updated time.Time `xorm:"UPDATED"` } +// Cell2Int64 converts a xorm.Cell type to int64, +// and handles possible irregular cases. +func Cell2Int64(val xorm.Cell) int64 { + switch (*val).(type) { + case []int8: + log.Trace("Cell2Int64 ([]int8): %v", *val) + return int64((*val).([]int8)[0]) + } + return (*val).(int64) +} + func (source *LoginSource) BeforeSet(colName string, val xorm.Cell) { switch colName { case "type": - switch LoginType((*val).(int64)) { + switch LoginType(Cell2Int64(val)) { case LOGIN_LDAP, LOGIN_DLDAP: source.Cfg = new(LDAPConfig) case LOGIN_SMTP: diff --git a/templates/.VERSION b/templates/.VERSION index 861f2d9a71..f1eb383c3e 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.8.18.0109 \ No newline at end of file +0.8.19.0111 \ No newline at end of file