detached 7aeab86

fix(cache): skip SVG favicons to prevent conversion errors

commit
7aeab86975a29eeabd72f4a474884279e15af6ea
author
bamen · · 2025-10-06 17:44 UTC
committer
bamen · · 2025-10-06 17:02 UTC
parent
55d6e7c
signature
unsigned
1 file · +8 -3
M internal/cache/favicon.go +8 -3
@@ -13,6 +13,7 @@ import (
1313 "net/http"
1414 "os"
1515 "path/filepath"
16+ "strings"
1617 "time"
1718
1819 "github.com/bnema/dumber/internal/config"
@@ -113,6 +114,12 @@ func (fc *FaviconCache) getFilename(faviconURL string) string {
113114
114115 // downloadFavicon downloads a favicon and saves it to cache
115116 func (fc *FaviconCache) downloadFavicon(faviconURL string) error {
117+ // Skip SVG files - we can't convert them to PNG without additional dependencies
118+ if strings.HasSuffix(strings.ToLower(faviconURL), ".svg") {
119+ log.Printf("[favicon] Skipping SVG favicon: %s", faviconURL)
120+ return nil
121+ }
122+
116123 filename := fc.getFilename(faviconURL)
117124 cachedPath := filepath.Join(fc.cacheDir, filename)
118125
@@ -177,9 +184,7 @@ func (fc *FaviconCache) downloadFavicon(faviconURL string) error {
177184 if _, err := io.Copy(downloadFile, limitedBody); err != nil {
178185 return fmt.Errorf("failed to save favicon data: %w", err)
179186 }
180- if err := downloadFile.Close(); err != nil {
181- log.Printf("[favicon] failed to close download file: %v", err)
182- }
187+ // Note: downloadFile will be closed by the defer above, no need to close explicitly
183188
184189 // Detect if it's an ICO file and convert with ffmpeg if needed
185190 if err := fc.convertToPNG(tempDownloadFile, cachedPath, faviconURL); err != nil {
@@ -13,6 +13,7 @@ import (
13 "net/http"13 "net/http"
14 "os"14 "os"
15 "path/filepath"15 "path/filepath"
16+ "strings"
16 "time"17 "time"
17 18
18 "github.com/bnema/dumber/internal/config"19 "github.com/bnema/dumber/internal/config"
@@ -113,6 +114,12 @@ func (fc *FaviconCache) getFilename(faviconURL string) string {
113 114
114 // downloadFavicon downloads a favicon and saves it to cache115 // downloadFavicon downloads a favicon and saves it to cache
115 func (fc *FaviconCache) downloadFavicon(faviconURL string) error {116 func (fc *FaviconCache) downloadFavicon(faviconURL string) error {
117+ // Skip SVG files - we can't convert them to PNG without additional dependencies
118+ if strings.HasSuffix(strings.ToLower(faviconURL), ".svg") {
119+ log.Printf("[favicon] Skipping SVG favicon: %s", faviconURL)
120+ return nil
121+ }
122+
116 filename := fc.getFilename(faviconURL)123 filename := fc.getFilename(faviconURL)
117 cachedPath := filepath.Join(fc.cacheDir, filename)124 cachedPath := filepath.Join(fc.cacheDir, filename)
118 125
@@ -177,9 +184,7 @@ func (fc *FaviconCache) downloadFavicon(faviconURL string) error {
177 if _, err := io.Copy(downloadFile, limitedBody); err != nil {184 if _, err := io.Copy(downloadFile, limitedBody); err != nil {
178 return fmt.Errorf("failed to save favicon data: %w", err)185 return fmt.Errorf("failed to save favicon data: %w", err)
179 }186 }
180- if err := downloadFile.Close(); err != nil {187+ // Note: downloadFile will be closed by the defer above, no need to close explicitly
181- log.Printf("[favicon] failed to close download file: %v", err)
182- }
183 188
184 // Detect if it's an ICO file and convert with ffmpeg if needed189 // Detect if it's an ICO file and convert with ffmpeg if needed
185 if err := fc.convertToPNG(tempDownloadFile, cachedPath, faviconURL); err != nil {190 if err := fc.convertToPNG(tempDownloadFile, cachedPath, faviconURL); err != nil {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close