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

Fix Firefox regex to handle version without patch segment #530

Merged
merged 4 commits into from
May 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions regexes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ user_agent_parsers:
# AFTER THE EDGE CASES ABOVE!
# AFTER IE11
# BEFORE all other IE
- regex: '(Firefox)/(\d+)\.(\d+)\.(\d+)'
- regex: '(Firefox)/(\d+)\.(\d+)(?:\.(\d+)|$)'
- regex: '(Firefox)/(\d+)\.(\d+)(pre|[ab]\d+[a-z]*|)'


Expand Down Expand Up @@ -5549,7 +5549,7 @@ device_parsers:
device_replacement: 'Motorola$2'
brand_replacement: 'Motorola'
model_replacement: '$2'


##########
# nintendo
Expand Down
6 changes: 6 additions & 0 deletions test_resources/firefox_user_agent_strings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,12 @@ test_cases:
minor: '0'
patch: '1'

- user_agent_string: 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0'
family: 'Firefox'
major: '104'
minor: '0'
patch:

- user_agent_string: 'Mozilla/5.0 (X11; Linux armv7l; rv:2.1.1) Gecko/ Firefox/5.0.1'
family: 'Firefox'
major: '5'
Expand Down