fix(keys): validate keysPath non-empty in loadAndApplyKeys

Programmatic callers (or cobra MarkFlagRequired bypass) would
otherwise trigger os.Open("") with a confusing error message.
Matches existing profilePath / browserName validation style.
This commit is contained in:
moonD4rk
2026-05-24 20:27:58 +08:00
parent 54d5eb2b7c
commit 51f6a4893d
+3
View File
@@ -122,6 +122,9 @@ func loadAndApplyKeys(browserName, profilePath, keysPath string) ([]browser.Brow
if name == "" || name == "all" {
return nil, fmt.Errorf(`requires -b <browser> (single, not "all")`)
}
if keysPath == "" {
return nil, fmt.Errorf("requires -i <keys-file> (or - for stdin)")
}
var r io.Reader = os.Stdin
if keysPath != "-" {