Skip to content

openURL and canOpenURL crash the app if the argument is not a valid link #8837

@max-pv

Description

@max-pv

Problem Description

openURL and canOpenURL crash the app if the argument is not a valid link.

Steps To Reproduce

  1. Create a new RNW app,
  2. Import Linking from react-native,
  3. Try calling openURL('test') or canOpenURL('test')
  4. Observe the app crash

Expected Results

The app is not crashing, and canOpenURL returns false

CLI version

6.1.0

Environment

System:
    OS: Windows 10 10.0.19042
    CPU: (16) x64 AMD Ryzen 7 2700 Eight-Core Processor
    Memory: 7.95 GB / 15.95 GB
  Binaries:
    Node: 14.17.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.16299.0, 10.0.17134.0, 10.0.17763.0, 10.0.18362.0, 10.0.19041.0
  IDEs:
    Android Studio: Not Found
    Visual Studio: 16.8.30804.86 (Visual Studio Enterprise 2019), 17.0.31423.177 (Visual Studio Enterprise 2022)
  Languages:
    Java: 14.0.1 - C:\Program Files\OpenJDK\jdk-14.0.1\bin\javac.EXE
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1
    react-native: 0.66.0 => 0.66.0
    react-native-windows: 0.66.0 => 0.66.0
  npmGlobalPackages:
    *react-native*: Not Found

Target Platform Version

10.0.19041

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2019

Build Configuration

Debug

Snack, code example, screenshot, or link to a repository

Here is the repro repo: https://github.com/br4in3x/rnw-linking-problem

Steps to use:

  1. clone
  2. yarn
  3. yarn windows

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions