-
Notifications
You must be signed in to change notification settings - Fork 60
Fix getUseIpAddressForGeolocation always returning true #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@jaredmixpanel Can you get someone to review this PR? It seems like a serious bug -- library consumers think they're turning off IP tracking, but they're not, possibly breaking their regulatory commitments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a critical bug in the getUseIpAddressForGeolocation method where it always returned true, even when explicitly set to false. The issue stemmed from using || true as the fallback, which caused the logical OR to always return true when the value was false. The fix uses the in operator to explicitly check if the property exists before accessing it, correctly handling the case where the value is intentionally set to false.
Key Changes:
- Fixed boolean logic in
getUseIpAddressForGeolocationto properly returnfalsewhen explicitly configured - Minor code style improvement to import statement spacing
| getUseIpAddressForGeolocation(token) { | ||
| return ( | ||
| (this._config[token] && this._config[token].useIpAddressForGeolocation) || | ||
| true | ||
| ); | ||
| if ( | ||
| this._config[token] && | ||
| "useIpAddressForGeolocation" in this._config[token] | ||
| ) { | ||
| return this._config[token].useIpAddressForGeolocation; | ||
| } | ||
|
|
||
| return true; | ||
| } |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix correctly addresses the bug where getUseIpAddressForGeolocation always returned true due to the || true fallback. However, this fix lacks test coverage. Consider adding a test case to verify that when useIpAddressForGeolocation is explicitly set to false, the getter returns false rather than true. This would prevent regression of this bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
|
Sorry this took so long, thanks for the fix. Released with |
Fixes #315.
This is part 1 of 3 in a stack made with GitButler: