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

KaiOS could be mistaken for iOS #2673

Open
2 tasks done
varoot opened this issue Jul 25, 2023 · 0 comments
Open
2 tasks done

KaiOS could be mistaken for iOS #2673

varoot opened this issue Jul 25, 2023 · 0 comments
Labels
Package: browser Type: Bug 🐛 Something isn't working

Comments

@varoot
Copy link

varoot commented Jul 25, 2023

Overview

When ua-parser-js returns KaiOS, browser.isIOS is true instead of false.

This is because we use .includes instead of equal on this line in browser.ts

Example of user agents that would result in the bug

  • Mozilla/5.0 (Mobile; rv:37.0; 4044V) Gecko/68.0 Firefox/101.0 KaiOS/1.0
  • Mozilla/5.0 (Mobile; Nokia_8110_4G; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5

Example failing test:

  it('does not confuse KaiOS with iOS', () => {
    const browser = new Browser({
      userAgent:
        'Mozilla/5.0 (Mobile; rv:37.0; 4044V) Gecko/68.0 Firefox/101.0 KaiOS/1.0',
    });
    expect(browser.os).toBe('KaiOS');
    expect(browser.isIOS).toBe(false); // currently this fails
  });

Note: It looks like the newer versions of KaiOS might have been flagged as Android instead, so not sure how much impact of this bug would be.

Consuming repo

What repo were you working in when this issue occurred?

N/A, just from reviewing the code

Checklist

  • Please delete the labels section before submitting your issue
  • I have described this issue in a way that is actionable (if possible)
@varoot varoot added Type: Bug 🐛 Something isn't working Package: browser labels Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: browser Type: Bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant