detached 4169f15

fix(download): address lint and test follow-ups

commit
4169f1508d67db8817bcccd8d3755a07f3f21be4
author
brice · · 2026-04-19 19:08 UTC
parent
ac89917
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
4 files · +9 -7
M internal/infrastructure/cef/download_handler.go +1 -1
@@ -42,7 +42,7 @@ func newDownloadHandler(
4242 }
4343 }
4444
45-func (h *downloadHandler) canDownload(_ purecef.Browser, _ string, requestMethod string) bool {
45+func (h *downloadHandler) canDownload(_ purecef.Browser, _, requestMethod string) bool {
4646 return requestMethod == "" || strings.EqualFold(requestMethod, http.MethodGet)
4747 }
4848
@@ -42,7 +42,7 @@ func newDownloadHandler(
42 }42 }
43 }43 }
44 44
45-func (h *downloadHandler) canDownload(_ purecef.Browser, _ string, requestMethod string) bool {45+func (h *downloadHandler) canDownload(_ purecef.Browser, _, requestMethod string) bool {
46 return requestMethod == "" || strings.EqualFold(requestMethod, http.MethodGet)46 return requestMethod == "" || strings.EqualFold(requestMethod, http.MethodGet)
47 }47 }
48 48
M internal/infrastructure/cef/webview_handlers.go +1 -1
@@ -814,7 +814,7 @@ func (h *handlerSet) OnBeforeBrowse(browser purecef.Browser, frame purecef.Frame
814814 return true
815815 }
816816
817-func (h *handlerSet) CanDownload(browser purecef.Browser, url string, requestMethod string) bool {
817+func (h *handlerSet) CanDownload(browser purecef.Browser, url, requestMethod string) bool {
818818 handler := h.downloadHandler()
819819 if handler == nil {
820820 return false
@@ -814,7 +814,7 @@ func (h *handlerSet) OnBeforeBrowse(browser purecef.Browser, frame purecef.Frame
814 return true814 return true
815 }815 }
816 816
817-func (h *handlerSet) CanDownload(browser purecef.Browser, url string, requestMethod string) bool {817+func (h *handlerSet) CanDownload(browser purecef.Browser, url, requestMethod string) bool {
818 handler := h.downloadHandler()818 handler := h.downloadHandler()
819 if handler == nil {819 if handler == nil {
820 return false820 return false
M internal/infrastructure/downloadruntime/runtime_test.go +3 -3
@@ -15,9 +15,9 @@ type stubResponse struct {
1515 uri string
1616 }
1717
18-func (s stubResponse) GetMimeType() string { return s.mimeType }
19-func (s stubResponse) GetSuggestedFilename() string { return "" }
20-func (s stubResponse) GetUri() string { return s.uri }
18+func (s stubResponse) GetMimeType() string { return s.mimeType }
19+func (stubResponse) GetSuggestedFilename() string { return "" }
20+func (s stubResponse) GetUri() string { return s.uri }
2121
2222 type captureEvents struct {
2323 events []port.DownloadEvent
@@ -15,9 +15,9 @@ type stubResponse struct {
15 uri string15 uri string
16 }16 }
17 17
18-func (s stubResponse) GetMimeType() string { return s.mimeType }18+func (s stubResponse) GetMimeType() string { return s.mimeType }
19-func (s stubResponse) GetSuggestedFilename() string { return "" }19+func (stubResponse) GetSuggestedFilename() string { return "" }
20-func (s stubResponse) GetUri() string { return s.uri }20+func (s stubResponse) GetUri() string { return s.uri }
21 21
22 type captureEvents struct {22 type captureEvents struct {
23 events []port.DownloadEvent23 events []port.DownloadEvent
M internal/infrastructure/webkit/download_handler_test.go +4 -2
@@ -2,6 +2,7 @@ package webkit
22
33 import (
44 "context"
5+ "path/filepath"
56 "testing"
67
78 "github.com/bnema/dumber/internal/application/usecase"
@@ -30,12 +31,13 @@ func TestDownloadHandler_SetDownloadPath(t *testing.T) {
3031 prepareUC := usecase.NewPrepareDownloadUseCase(nil)
3132 handler := NewDownloadHandler("/initial/path", nil, prepareUC)
3233
33- handler.SetDownloadPath("/new/path")
34+ newPath := t.TempDir()
35+ handler.SetDownloadPath(newPath)
3436
3537 output, err := handler.runtime.ResolveDestination(context.Background(), "artifact.pdf", nil)
3638
3739 require.NoError(t, err)
38- assert.Equal(t, "/new/path/artifact.pdf", output.DestinationPath)
40+ assert.Equal(t, filepath.Join(newPath, "artifact.pdf"), output.DestinationPath)
3941 }
4042
4143 func TestURIResponseAdapter(t *testing.T) {
@@ -2,6 +2,7 @@ package webkit
2 2
3 import (3 import (
4 "context"4 "context"
5+ "path/filepath"
5 "testing"6 "testing"
6 7
7 "github.com/bnema/dumber/internal/application/usecase"8 "github.com/bnema/dumber/internal/application/usecase"
@@ -30,12 +31,13 @@ func TestDownloadHandler_SetDownloadPath(t *testing.T) {
30 prepareUC := usecase.NewPrepareDownloadUseCase(nil)31 prepareUC := usecase.NewPrepareDownloadUseCase(nil)
31 handler := NewDownloadHandler("/initial/path", nil, prepareUC)32 handler := NewDownloadHandler("/initial/path", nil, prepareUC)
32 33
33- handler.SetDownloadPath("/new/path")34+ newPath := t.TempDir()
35+ handler.SetDownloadPath(newPath)
34 36
35 output, err := handler.runtime.ResolveDestination(context.Background(), "artifact.pdf", nil)37 output, err := handler.runtime.ResolveDestination(context.Background(), "artifact.pdf", nil)
36 38
37 require.NoError(t, err)39 require.NoError(t, err)
38- assert.Equal(t, "/new/path/artifact.pdf", output.DestinationPath)40+ assert.Equal(t, filepath.Join(newPath, "artifact.pdf"), output.DestinationPath)
39 }41 }
40 42
41 func TestURIResponseAdapter(t *testing.T) {43 func TestURIResponseAdapter(t *testing.T) {

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