#2349 try to handle []int8 case
This commit is contained in:
		
							parent
							
								
									17c4400b12
								
							
						
					
					
						commit
						91bab801aa
					
				
					 5 changed files with 16 additions and 4 deletions
				
			
		|  | @ -3,7 +3,7 @@ Gogs - Go Git Service [ |  | ||||||
| 
 | 
 | ||||||
| ##### Current version: 0.8.18 | ##### Current version: 0.8.19 | ||||||
| 
 | 
 | ||||||
| | Web | UI  | Preview  | | | Web | UI  | Preview  | | ||||||
| |:-------------:|:-------:|:-------:| | |:-------------:|:-------:|:-------:| | ||||||
|  |  | ||||||
|  | @ -9,6 +9,7 @@ Aleksey Tarakin <hukendo AT yandex DOT ru> | ||||||
| Alexander Steinhöfer <kontakt AT lx-s DOT de> | Alexander Steinhöfer <kontakt AT lx-s DOT de> | ||||||
| Alexandre Magno <alexandre DOT mbm AT gmail DOT com> | Alexandre Magno <alexandre DOT mbm AT gmail DOT com> | ||||||
| Andrey Nering <andrey AT nering DOT com DOT br> | Andrey Nering <andrey AT nering DOT com DOT br> | ||||||
|  | Andrey Solomatin <toadron AT yandex DOT ru> | ||||||
| Arthur Aslanyan <arthur DOT e DOT aslanyan AT gmail DOT com> | Arthur Aslanyan <arthur DOT e DOT aslanyan AT gmail DOT com> | ||||||
| Barış Arda Yılmaz <ardayilmazgamer AT gmail DOT com> | Barış Arda Yılmaz <ardayilmazgamer AT gmail DOT com> | ||||||
| Christoph Kisfeld <christoph DOT kisfeld AT gmail DOT com> | Christoph Kisfeld <christoph DOT kisfeld AT gmail DOT com> | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							|  | @ -17,7 +17,7 @@ import ( | ||||||
| 	"github.com/gogits/gogs/modules/setting" | 	"github.com/gogits/gogs/modules/setting" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| const APP_VER = "0.8.18.0109" | const APP_VER = "0.8.19.0111" | ||||||
| 
 | 
 | ||||||
| func init() { | func init() { | ||||||
| 	runtime.GOMAXPROCS(runtime.NumCPU()) | 	runtime.GOMAXPROCS(runtime.NumCPU()) | ||||||
|  |  | ||||||
|  | @ -105,10 +105,21 @@ type LoginSource struct { | ||||||
| 	Updated   time.Time       `xorm:"UPDATED"` | 	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) { | func (source *LoginSource) BeforeSet(colName string, val xorm.Cell) { | ||||||
| 	switch colName { | 	switch colName { | ||||||
| 	case "type": | 	case "type": | ||||||
| 		switch LoginType((*val).(int64)) { | 		switch LoginType(Cell2Int64(val)) { | ||||||
| 		case LOGIN_LDAP, LOGIN_DLDAP: | 		case LOGIN_LDAP, LOGIN_DLDAP: | ||||||
| 			source.Cfg = new(LDAPConfig) | 			source.Cfg = new(LDAPConfig) | ||||||
| 		case LOGIN_SMTP: | 		case LOGIN_SMTP: | ||||||
|  |  | ||||||
|  | @ -1 +1 @@ | ||||||
| 0.8.18.0109 | 0.8.19.0111 | ||||||
		Loading…
	
		Reference in a new issue