Skip to content

Commit

Permalink
Merge pull request #180 from subutai-io/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
crioto authored Dec 19, 2017
2 parents 1ecdec9 + 622fb42 commit b75e14a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type ListItem struct {
ID string `json:"id"`
Hash hashsums `json:"hash"`
Size int `json:"size"`
Date time.Time `json:"upload-date-formatted"`
Timestamp string `json:"upload-date-timestamp,omitempty"`
Name string `json:"name,omitempty"`
Tags []string `json:"tags,omitempty"`
Owner []string `json:"owner,omitempty"`
Expand Down Expand Up @@ -226,8 +228,11 @@ func formatItem(info map[string]string, repo, name string) ListItem {
info["prefsize"] = "tiny"
}

date, _ := time.Parse(time.RFC3339Nano, info["date"])
timestamp := strconv.FormatInt(date.Unix(), 10)
item := ListItem{
ID: info["id"],
Date: date,
Hash: hashsums{Md5: info["md5"], Sha256: info["sha256"]},
Name: strings.Split(info["name"], "-subutai-template")[0],
Tags: db.FileField(info["id"], "tags"),
Expand All @@ -238,12 +243,14 @@ func formatItem(info map[string]string, repo, name string) ListItem {
Prefsize: info["prefsize"],
Architecture: strings.ToUpper(info["arch"]),
Description: info["Description"],
Timestamp: timestamp,
}
item.Size, _ = strconv.Atoi(info["size"])

if repo == "apt" {
item.Version = info["Version"]
item.Architecture = info["Architecture"]
item.Size, _ = strconv.Atoi(info["Size"])
}
if len(item.Hash.Md5) == 0 {
item.Hash.Md5 = item.ID
Expand Down

0 comments on commit b75e14a

Please sign in to comment.