detached 61e5cb1

fix(preview): skip preview domains when resolving base route from config

When FindRoutesByImage falls back to route config, filter out domains
containing the preview separator to prevent using a preview domain as
the base for another preview (which produces double-separator names).
commit
61e5cb144927e0dbb2f1edabbf0f2ec83e612a68
author
brice · · 2026-03-18 20:37 UTC
committer
brice · · 2026-03-18 19:49 UTC
parent
a3061c7
signature
unsigned
1 file · +7 -2
M internal/usecase/auto/preview/handler.go +7 -2
@@ -3,6 +3,7 @@ package preview
33 import (
44 "context"
55 "fmt"
6+ "strings"
67
78 "github.com/bnema/zerowrap"
89
@@ -62,12 +63,16 @@ func (h *AutoPreviewHandler) Handle(ctx context.Context, event domain.Event) err
6263 previewConfig := h.config.GetPreviewConfig()
6364 previewName := ExtractPreviewName(payload.Reference, previewConfig.TagPatterns)
6465
65- // Resolve base route: labels first, then route config fallback
66+ // Resolve base route: labels first, then route config fallback.
67+ // When falling back to routes, skip preview domains (they contain the separator)
68+ // to avoid using a preview as the base for another preview.
6669 domains := collectDomains(labels)
6770 if len(domains) == 0 {
6871 routes := h.config.FindRoutesByImage(ctx, payload.Name)
6972 for _, r := range routes {
70- domains = append(domains, r.Domain)
73+ if !strings.Contains(r.Domain, previewConfig.Separator) {
74+ domains = append(domains, r.Domain)
75+ }
7176 }
7277 }
7378 if len(domains) == 0 {
@@ -3,6 +3,7 @@ package preview
3 import (3 import (
4 "context"4 "context"
5 "fmt"5 "fmt"
6+ "strings"
6 7
7 "github.com/bnema/zerowrap"8 "github.com/bnema/zerowrap"
8 9
@@ -62,12 +63,16 @@ func (h *AutoPreviewHandler) Handle(ctx context.Context, event domain.Event) err
62 previewConfig := h.config.GetPreviewConfig()63 previewConfig := h.config.GetPreviewConfig()
63 previewName := ExtractPreviewName(payload.Reference, previewConfig.TagPatterns)64 previewName := ExtractPreviewName(payload.Reference, previewConfig.TagPatterns)
64 65
65- // Resolve base route: labels first, then route config fallback66+ // Resolve base route: labels first, then route config fallback.
67+ // When falling back to routes, skip preview domains (they contain the separator)
68+ // to avoid using a preview as the base for another preview.
66 domains := collectDomains(labels)69 domains := collectDomains(labels)
67 if len(domains) == 0 {70 if len(domains) == 0 {
68 routes := h.config.FindRoutesByImage(ctx, payload.Name)71 routes := h.config.FindRoutesByImage(ctx, payload.Name)
69 for _, r := range routes {72 for _, r := range routes {
70- domains = append(domains, r.Domain)73+ if !strings.Contains(r.Domain, previewConfig.Separator) {
74+ domains = append(domains, r.Domain)
75+ }
71 }76 }
72 }77 }
73 if len(domains) == 0 {78 if len(domains) == 0 {

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 7

Tags 106

↑↓ moveenter openesc close