Display hash in hexadecimal form
This commit is contained in:
parent
69ad64715c
commit
2f61d4d141
1 changed files with 4 additions and 3 deletions
|
@ -1,8 +1,10 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -19,7 +21,7 @@ var ApiTeamsRouting = map[string]DispatchFunction{
|
||||||
type myTeamFile struct {
|
type myTeamFile struct {
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Checksum []byte `json:"checksum"`
|
Checksum string `json:"checksum"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
}
|
}
|
||||||
type myTeamExercice struct {
|
type myTeamExercice struct {
|
||||||
|
@ -62,14 +64,13 @@ func myJSONTeam(t fic.Team) (interface{}, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exercice.Files = []myTeamFile{}
|
exercice.Files = []myTeamFile{}
|
||||||
|
|
||||||
if files, err := e.GetFiles(); err != nil {
|
if files, err := e.GetFiles(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
for _, f := range files {
|
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})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue