Skip to content

Commit

Permalink
only return icon if it exists
Browse files Browse the repository at this point in the history
We would previously return an empty 200 response for the icon asset request, and a link to the icon for charts that don't have icons
  • Loading branch information
Adnan Abdulhussein committed Jan 4, 2018
1 parent f925eb1 commit 4cce440
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ func getChartIcon(w http.ResponseWriter, req *http.Request, params Params) {
return
}

if chart.RawIcon == nil {
http.NotFound(w, req)
return
}

w.Write(chart.RawIcon)
}

Expand Down Expand Up @@ -206,7 +211,9 @@ func chartVersionAttributes(cid string, cv models.ChartVersion) models.ChartVers
}

func chartAttributes(c models.Chart) models.Chart {
c.Icon = "/v1/assets/" + c.ID + "/logo-160x160-fit.png"
if c.RawIcon != nil {
c.Icon = "/v1/assets/" + c.ID + "/logo-160x160-fit.png"
}
return c
}

Expand Down

0 comments on commit 4cce440

Please sign in to comment.