From 63c79ee56ff5669958794ac28af4bbce5605d221 Mon Sep 17 00:00:00 2001 From: Florian Hoss Date: Mon, 30 Sep 2024 14:14:09 +0200 Subject: [PATCH] Fix extension problem --- services/bookmark.services.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/bookmark.services.go b/services/bookmark.services.go index ba8dcb6..54dd4a2 100644 --- a/services/bookmark.services.go +++ b/services/bookmark.services.go @@ -29,7 +29,7 @@ applications: ignore_color: true url: "https://github.com" - name: "Home Assistant" - icon: "shi/homeassistant.svg" + icon: "shi/home-assistant.svg" url: "https://www.home-assistant.io/"` func init() { @@ -100,14 +100,14 @@ func (bs *BookmarkService) replaceIconStrings() { data, err := os.ReadFile(iconsFolder + title) if os.IsNotExist(err) { slog.Debug("icon not found, downloading...", "title", title) - resp, err := http.Get("https://cdn.jsdelivr.net/gh/selfhst/icons/" + ext + "/" + title) + resp, err := http.Get("https://cdn.jsdelivr.net/gh/selfhst/icons/" + strings.TrimPrefix(ext, ".") + "/" + title) if err != nil { slog.Error("failed to get icon", "err", err.Error()) continue } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - slog.Error("failed to get icon", "status", resp.Status) + slog.Error("failed to get icon", "status", resp.Status, "url", resp.Request.URL.String()) continue } data, err = io.ReadAll(resp.Body) @@ -127,7 +127,6 @@ func (bs *BookmarkService) replaceIconStrings() { } bs.bookmarks.Applications[i].Entries[j].Icon = insertWidthHeight(string(data)) } - } } }