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

Microsoft Vista os not parsed correctly #120

Open
lusarz opened this issue Feb 12, 2018 · 4 comments
Open

Microsoft Vista os not parsed correctly #120

lusarz opened this issue Feb 12, 2018 · 4 comments

Comments

@lusarz
Copy link

lusarz commented Feb 12, 2018

I see that current output of:

useragent
  .parse('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E)')
  .os

is:
OperatingSystem { family: 'Windows', major: 'Vista', minor: '0', patch: '0' }

Some time ago it was:
OperatingSystem { family: 'Windows Vista', major: '0', minor: '0', patch: '0' }

This cause errors in karma build:
https://ci.appveyor.com/project/dignifiedquire/karma/build/1628/job/1a6b81i60l6wh52f

After some investigation I found that it seems to be related with this commit:
0e28927

@mmermerkaya
Copy link

This is because of an upstream change: ua-parser/uap-core#286

@3rd-Eden Would you be willing to approve a PR that removes adding minor and patch values that are "0" (or null) to the stringified OS, so for example Vista would be stringified as "Windows Vista" instead of "Windows Vista.0.0"?

@mgol
Copy link

mgol commented Jun 13, 2018

The changes in the regexps were intentional so it seems useragent needs to update its logic. I wonder how to best handle that. If a browser represents the OS as, for example, macOS 10.13.0 then the 0 at the end is meaningful and shouldn't be stripped.

Shouldn't useragent stop filling in non-provided fields with zeros? This would invalidate the following test:

it('should not throw errors on empty strings and default to unkown', function () {
var agent = useragent.parse('');
assume(agent.family).equals('Other');
assume(agent.major).equals('0');
assume(agent.minor).equals('0');
assume(agent.patch).equals('0');
assume(agent.os.toString()).equals('Other 0.0.0');
assume(agent.toVersion()).equals('0.0.0');
assume(agent.toString()).equals('Other 0.0.0 / Other 0.0.0');
assume(agent.toAgent()).equals('Other 0.0.0');
assume(JSON.stringify(agent)).equals('{"family":"Other","major":"0","minor":"0","patch":"0","device":{"family":"Other","major":"0","minor":"0","patch":"0"},"os":{"family":"Other","major":"0","minor":"0","patch":"0"}}');
});

This issue is a blocker for Karma as I understand.

@mgol
Copy link

mgol commented Nov 3, 2018

@3rd-Eden could you weigh in if such a change would be accepted?

@mgol
Copy link

mgol commented Jul 15, 2019

Ping @3rd-Eden

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

No branches or pull requests

3 participants