A self-hosted dashboard that puts all your feeds in one place
Go aggregatordashboarddockerfeed-readergohomelabhomepagemonitoringredditrssrss-readerself-hostedstartpageyoutube
Fix failing to parse empty response body in custom api widget
Svilen Markov31ecd91f7c7a
diff --git a/internal/glance/widget-custom-api.go b/internal/glance/widget-custom-api.goindex 1c50ad6..5ea7bf7 100644--- a/internal/glance/widget-custom-api.go+++ b/internal/glance/widget-custom-api.go@@ -10,6 +10,7 @@ import ("log/slog""math""net/http"+ "strings""time""github.com/tidwall/gjson"@@ -90,9 +91,9 @@ func fetchAndParseCustomAPI(req *http.Request, tmpl *template.Template) (templatreturn emptyBody, err}- body := string(bodyBytes)+ body := strings.TrimSpace(string(bodyBytes))- if !gjson.Valid(body) {+ if body != "" && !gjson.Valid(body) {truncatedBody, isTruncated := limitStringLength(body, 100)if isTruncated {truncatedBody += "... <truncated>"