In browser_init.go:128-158, mergeOptions() treats ShowBrowser differently from all other boolean fields:
funcmergeOptions(baseBrowserOptions,opts[]BrowserOptions)BrowserOptions{for_,o:=rangeopts{// ...ifo.RequireServer{base.RequireServer=true// only sets if true}ifo.UseLocalOnly{base.UseLocalOnly=true// only sets if true}base.ShowBrowser=o.ShowBrowser// ALWAYS overwrites}returnbase}
Unlike RequireServer and UseLocalOnly which only set to true, ShowBrowser is unconditionally overwritten. This means:
If you pass BrowserOptions{ShowBrowser: true} followed by BrowserOptions{UserAgent: "custom"}, the second option resets ShowBrowser to false even though it wasn't explicitly set.
Fix
Either:
Treat ShowBrowser consistently with other booleans: if o.ShowBrowser { base.ShowBrowser = true }
Or use a pointer *bool for all optional boolean fields to distinguish "not set" from "set to false"
**Parent:** #3
## Description
In `browser_init.go:128-158`, `mergeOptions()` treats `ShowBrowser` differently from all other boolean fields:
```go
func mergeOptions(base BrowserOptions, opts []BrowserOptions) BrowserOptions {
for _, o := range opts {
// ...
if o.RequireServer {
base.RequireServer = true // only sets if true
}
if o.UseLocalOnly {
base.UseLocalOnly = true // only sets if true
}
base.ShowBrowser = o.ShowBrowser // ALWAYS overwrites
}
return base
}
```
Unlike `RequireServer` and `UseLocalOnly` which only set to `true`, `ShowBrowser` is unconditionally overwritten. This means:
- If you pass `BrowserOptions{ShowBrowser: true}` followed by `BrowserOptions{UserAgent: "custom"}`, the second option resets `ShowBrowser` to `false` even though it wasn't explicitly set.
## Fix
Either:
1. Treat `ShowBrowser` consistently with other booleans: `if o.ShowBrowser { base.ShowBrowser = true }`
2. Or use a pointer `*bool` for all optional boolean fields to distinguish "not set" from "set to false"
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Parent: #3
Description
In
browser_init.go:128-158,mergeOptions()treatsShowBrowserdifferently from all other boolean fields:Unlike
RequireServerandUseLocalOnlywhich only set totrue,ShowBrowseris unconditionally overwritten. This means:BrowserOptions{ShowBrowser: true}followed byBrowserOptions{UserAgent: "custom"}, the second option resetsShowBrowsertofalseeven though it wasn't explicitly set.Fix
Either:
ShowBrowserconsistently with other booleans:if o.ShowBrowser { base.ShowBrowser = true }*boolfor all optional boolean fields to distinguish "not set" from "set to false"Starting work on this as part of PR 7 (also includes #15). Will change
ShowBrowserto*boolso nil means "don't override" inmergeOptions().Work finished. PR: #38 (merged)
Changed
ShowBrowserto*boolwithextractor.Bool()helper. Nil now means "don't override" inmergeOptions().Resolved by PR #38 —
ShowBrowserchanged to*boolinBrowserOptionssonilmeans "don't override". Browser defaults also aligned to Firefox.