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

Detect opera as browser in user_agent #1556

Closed
attack68 opened this issue May 23, 2019 · 0 comments · Fixed by #1564
Closed

Detect opera as browser in user_agent #1556

attack68 opened this issue May 23, 2019 · 0 comments · Fixed by #1564

Comments

@attack68
Copy link

@attack68 attack68 commented May 23, 2019

Expected Behavior

user_agent.browser is reported as opera and user_agent.version as 60 when browsing using Opera 60 in MacOs 10.13.5.

@web.route('/test')
def test():
    browser = request.user_agent.browser
    version = request.user_agent.version and int(request.user_agent.version.split('.')[0])
    platform = request.user_agent.platform
    uas = request.user_agent.string
    jsonify(dict(browser=browser, version=version, platform=platform, uas=uas))

Actual Behavior

When using Opera the report is as follows (note the 'OPR/60'):

{
  "browser": "chrome", 
  "platform": "macos", 
  "uas": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.95", 
  "version": 73
}

When using Chrome the report is:

{
  "browser": "chrome", 
  "platform": "macos", 
  "uas": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36", 
  "version": 74
}

Environment

  • Python version: 3.7.0
  • Flask version: 1.0.2
  • Werkzeug version: 0.14.1
@davidism davidism transferred this issue from pallets/flask May 23, 2019
johnzeringue added a commit to johnzeringue/werkzeug that referenced this issue May 31, 2019
Now, we'll recognize `OPR` as "Opera" in a user agent string.

Fixes pallets#1556
johnzeringue added a commit to johnzeringue/werkzeug that referenced this issue May 31, 2019
Now, we'll recognize `OPR` as "Opera" in a user agent string.

Fixes pallets#1556
@davidism davidism added this to the 1.0.0 milestone May 31, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants