tpl: Fix indeterminate template lookup with templates with and without lang

Close #13636
This commit is contained in:
Bjørn Erik Pedersen
2025-04-21 18:02:50 +02:00
parent db72a1f075
commit 6d69dc88a4
5 changed files with 120 additions and 17 deletions

View File

@@ -1842,7 +1842,9 @@ func (best *bestMatch) isBetter(w weight, ti *TemplInfo) bool {
// Anything is better than nothing.
return true
}
if w.w1 <= 0 {
if best.w.w1 <= 0 {
return ti.PathInfo.Path() < best.templ.PathInfo.Path()
}
@@ -1885,11 +1887,7 @@ func (best *bestMatch) isBetter(w weight, ti *TemplInfo) bool {
return true
}
if ti.D.LayoutFromTemplate != "" && best.desc.LayoutFromTemplate != "" {
return ti.D.LayoutFromTemplate != layoutAll
}
return w.distance < best.w.distance || ti.PathInfo.Path() < best.templ.PathInfo.Path()
return ti.PathInfo.Path() < best.templ.PathInfo.Path()
}
return true