mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
fix (#533): json conversion issue
This commit is contained in:
parent
aefe20bd26
commit
86dde05507
1 changed files with 4 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ package common
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
@ -58,8 +59,9 @@ func NewStringpFromInterface(val interface{}) *string {
|
||||||
func NewStringFromInterface(val interface{}) string {
|
func NewStringFromInterface(val interface{}) string {
|
||||||
switch val.(type) {
|
switch val.(type) {
|
||||||
case string:
|
case string:
|
||||||
v := val.(string)
|
return val.(string)
|
||||||
return v
|
case float64:
|
||||||
|
return fmt.Sprintf("%d", int64(val.(float64)))
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue