Skip to content
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

fix(user-agent): guard against null-refs when parsing Safari user-agents #188

Merged
merged 1 commit into from
May 29, 2015

Conversation

booleanbetrayal
Copy link
Contributor

the specific problematic user-agent that we ran into was googlebot's:

AdsBot-Google-Mobile (+http://www.google.com/mobile/adsbot.html) Mozilla (iPhone; U; CPU iPhone OS 3 0 like Mac OS X) AppleWebKit (KHTML, like Gecko) Mobile Safari

I removed the blacklisting of Chrome and PhantomJS from the conditional as neither have "version" anywhere in their agents, and the more generalized fix should catch them fine.

Didn't produce dist assets, but can do so if needed. Likewise, let me know if you want any tweaks to the implementation.

@ocombe
Copy link
Owner

ocombe commented May 28, 2015

Damn user agent tests, that's why I didn't want to include this test in the first place, but there was no easy other way to "fix" this bug :(
Thanks for the PR, I'll run it against a few browsers to make sure and merge it if everything is ok :)

@booleanbetrayal
Copy link
Contributor Author

Sounds good! FWIW - I've found this guy to be kinda handy for sanitizing those necessary evil agent-strings: https://github.com/faisalman/ua-parser-js . Not sure if it's worth the trouble or not given the use case. 12k minified is still 12k minified.

ocombe added a commit that referenced this pull request May 29, 2015
fix: guard against null-refs when parsing Safari user-agents
@ocombe ocombe merged commit 6733616 into ocombe:master May 29, 2015
@ocombe
Copy link
Owner

ocombe commented May 29, 2015

All is working fine, thanks :)

@booleanbetrayal
Copy link
Contributor Author

great! would it be possible to get a new minor version build / bump published today?

@ocombe
Copy link
Owner

ocombe commented May 29, 2015

Yes, I'm fixing a few more bugs and I'll release it

@booleanbetrayal
Copy link
Contributor Author

👍 and thanks for this great module!

@booleanbetrayal booleanbetrayal deleted the fix_googlebot_nullref branch May 29, 2015 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants