Display hash in hexadecimal form

This commit is contained in:
nemunaire 2016-01-20 22:47:23 +01:00
parent 69ad64715c
commit 2f61d4d141
1 changed files with 4 additions and 3 deletions

View File

@ -1,8 +1,10 @@
package main
import (
"encoding/hex"
"encoding/json"
"fmt"
"path"
"strconv"
"time"
@ -19,7 +21,7 @@ var ApiTeamsRouting = map[string]DispatchFunction{
type myTeamFile struct {
Path string `json:"path"`
Name string `json:"name"`
Checksum []byte `json:"checksum"`
Checksum string `json:"checksum"`
Size int64 `json:"size"`
}
type myTeamExercice struct {
@ -62,14 +64,13 @@ func myJSONTeam(t fic.Team) (interface{}, error) {
}
}
exercice.Files = []myTeamFile{}
if files, err := e.GetFiles(); err != nil {
return nil, err
} else {
for _, f := range files {
exercice.Files = append(exercice.Files, myTeamFile{f.Path, f.Name, f.Checksum, f.Size})
exercice.Files = append(exercice.Files, myTeamFile{path.Join("/files", f.Path), f.Name, hex.EncodeToString(f.Checksum), f.Size})
}
}