Reject selected catalog entries without source paths

This commit is contained in:
2026-11-27 21:16:27 +00:00
parent d4036eea47
commit 447888e062
3 changed files with 94 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
package config
import "fmt"
import (
"fmt"
"strings"
)
// SelectSetting returns the source for a selected setting, or no source for an omitted selection.
func (catalog ReferenceCatalogConfig) SelectSetting(id string) (string, error) {
@@ -20,5 +23,8 @@ func selectReference(kind, id string, entries map[string]string) (string, error)
if !ok {
return "", fmt.Errorf("unknown reference catalog %s %q", kind, id)
}
if strings.TrimSpace(path) == "" {
return "", fmt.Errorf("reference catalog %s %q has an empty source path", kind, id)
}
return path, nil
}