elixir-inspector / ua_inspector

User agent parser library
Apache License 2.0
125 stars 23 forks source link

Version.InvalidVersionError due to version with prerelease #35

Closed macobo closed 7 months ago

macobo commented 7 months ago

The following parsing fails

iex(4)> UAInspector.parse("Mozilla/5.0 (Linux; arm_64; Android 10; Mi Note 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.5765.05 Mobile Safari/537.36")
** (Version.InvalidVersionError) invalid version: "115.0.5765-05"
    (elixir 1.16.0) lib/version.ex:475: Version.to_matchable/2
    (elixir 1.16.0) lib/version.ex:347: Version.compare/2
    (ua_inspector 3.9.0) lib/ua_inspector/parser/client.ex:293: UAInspector.Parser.Client.resolve_engine_detailed/3
    (ua_inspector 3.9.0) lib/ua_inspector/parser/client.ex:266: UAInspector.Parser.Client.maybe_resolve_engine/4
    (ua_inspector 3.9.0) lib/ua_inspector/parser/client.ex:322: UAInspector.Parser.Client.result/3
    (ua_inspector 3.9.0) lib/ua_inspector/parser/client.ex:24: UAInspector.Parser.Client.parse/2
    (ua_inspector 3.9.0) lib/ua_inspector/parser.ex:155: UAInspector.Parser.parse_client/2
    iex:4: (file)

Problem seems to be using the elixir Version module to compare semver strings with prerelease tags?