Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
Fixed bug when extracting windows 10
Browse files Browse the repository at this point in the history
Windows 10 is actually Windows NT 10.0 and not Windows NT 6.4.

Resolves: #21
  • Loading branch information
nivnadler committed Dec 28, 2015
1 parent 783ec61 commit 8d86c2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ var expected = []string{
"Mozilla:4.0 Platform:Windows OS:Windows 8.1 Browser:Internet Explorer-7.0 Engine:Trident Bot:false Mobile:false",

// Microsoft Edge
"Mozilla:5.0 Platform:Windows OS:Windows NT 10.0 Browser:Edge-12.10240 Engine:EdgeHTML Bot:false Mobile:false",
"Mozilla:5.0 Platform:Windows OS:Windows 10 Browser:Edge-12.10240 Engine:EdgeHTML Bot:false Mobile:false",
"Mozilla:5.0 Platform:Windows OS:Windows Phone 10.0 Browser:Edge-12.10240 Engine:EdgeHTML Bot:false Mobile:true",

// Gecko
Expand Down
6 changes: 3 additions & 3 deletions operating_systems.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ package user_agent
import "strings"

// Normalize the name of the operating system. By now, this just
// affects to Windows.
// affects to Windows NT.
//
// Returns a string containing the normalized name for the Operating System.
func normalizeOS(name string) string {
sp := strings.SplitN(name, " ", 3)
if len(sp) != 3 {
if len(sp) != 3 || sp[1] != "NT" {
return name
}

Expand All @@ -33,7 +33,7 @@ func normalizeOS(name string) string {
return "Windows 8"
case "6.3":
return "Windows 8.1"
case "6.4":
case "10.0":
return "Windows 10"
}
return name
Expand Down

0 comments on commit 8d86c2c

Please sign in to comment.