small tweaks
This commit is contained in:
@@ -55,6 +55,7 @@ func tmpltWebRoot(w http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
msgBuffer bytes.Buffer
|
||||
cves []cisa.VulStruct
|
||||
num int = 3
|
||||
)
|
||||
|
||||
c := cisa.Read()
|
||||
@@ -65,10 +66,14 @@ func tmpltWebRoot(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
if len(cves) < 3 {
|
||||
num = len(cves)
|
||||
}
|
||||
|
||||
if err := tmplt.Execute(&msgBuffer, struct {
|
||||
CVEs []cisa.VulStruct
|
||||
}{
|
||||
CVEs: cves[len(cves)-3:],
|
||||
CVEs: cves[len(cves)-num:],
|
||||
}); err != nil {
|
||||
config.Cfg.Log.Debug("unable to execute html template", err)
|
||||
tmpltError(w, http.StatusInternalServerError, "Template Parse Error.")
|
||||
|
Reference in New Issue
Block a user