mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
Use lenient version parser to properly parse version provided by Mac
This commit is contained in:
committed by
Jakub Cuth
parent
72c01046e3
commit
e055acb8eb
@ -20,6 +20,7 @@ package useragent
|
||||
import (
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/Masterminds/semver/v3"
|
||||
)
|
||||
@ -38,11 +39,11 @@ func getMacVersion() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
return string(out)
|
||||
return strings.TrimSpace(string(out))
|
||||
}
|
||||
|
||||
func isVersionCatalinaOrNewer(version string) bool {
|
||||
v, err := semver.StrictNewVersion(version)
|
||||
v, err := semver.NewVersion(version)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ func TestIsVersionCatalinaOrNewer(t *testing.T) {
|
||||
{"10.15.0"}: true,
|
||||
{"10.16.0"}: true,
|
||||
{"11.0.0"}: true,
|
||||
{"11.1"}: true,
|
||||
}
|
||||
|
||||
for args, exp := range testData {
|
||||
|
||||
Reference in New Issue
Block a user