You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, the problem originally reported in #35 still persists for exact same example UA string:
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"
I have done some digging - my findings follow below:
test"engine version with leading zero in fourth place (x.y.z.0[0-9]+)"do
agent=
"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"
parsed=UAInspector.parse(agent)
result=%UAInspector.Result.Client{
engine: "WebKit",
engine_version: "537.36",
name: "Chrome Mobile",
type: "browser",
version: "115.0.5765.05"
}
assert^result=parsed.client
end
, it does not really test for problematic version comparison. That's because the default database fixture used in tests does not have a matching "WebKit" entry with "versions", so the code path resolving and comparing versions at
to fail because leading "0" in prerelease is treated as invalid (which is correct according to https://semver.org/ AFAICT, so it seems to make sense that Version follows that spec). Unfortunately, apparently versions in UA do not always follow the conventions.
Perhaps it would make sense to sanitize the prerelease by trimming any leading zeroes somewhere close to
Unfortunately, the problem originally reported in #35 still persists for exact same example UA string:
I have done some digging - my findings follow below:
Although there is a regression test added at
ua_inspector/test/ua_inspector/parser/client_test.exs
Lines 39 to 54 in 8954721
ua_inspector/lib/ua_inspector/parser/client.ex
Line 304 in 8954721
The root problem here seems to be the fact that after semver conversion for comparison, the version string ends up like this:
which in turn causes
ua_inspector/lib/ua_inspector/util/version.ex
Line 29 in 8954721
Version
follows that spec). Unfortunately, apparently versions in UA do not always follow the conventions.Perhaps it would make sense to sanitize the prerelease by trimming any leading zeroes somewhere close to
ua_inspector/lib/ua_inspector/util/version.ex
Lines 157 to 161 in 8954721
The text was updated successfully, but these errors were encountered: