Skip to content

[url_launcher] URL logged on error is wrong on Windows #159009

@anayw2001

Description

@anayw2001

Steps to reproduce

  1. Call launchUrl on a file URL that doesn't exist.

Expected results

I expect the decoded file URL to be the one logged, not the encoded one.

Actual results

The logged URL is URL-encoded.

Code sample

Code sample
import 'package:url_launcher/url_launcher.dart';

void main() {
  launchUrl(Uri.parse('file://C:\Users\exampleé\sample.txt'));
}

Screenshots or Video

No response

Logs

Logs
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(open_error, Failed to open file:///C:/Users/example%C3%A9/sample.txt: ShellExecute error code 2, null, null)
#0      UrlLauncherApi.launchUrl (package:url_launcher_windows/src/messages.g.dart:83:7)
<asynchronous suspension>

Flutter Doctor output

Doctor output
PS C:\Users\anay1> flutter doctor -v
[✓] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22631.4169], locale en-US)
    • Flutter version 3.24.3 on channel stable at C:\Users\anay1\flutter\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (5 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/to/windows-android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.11.35312.102
    • Windows 10 SDK version 10.0.22621.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/windows-android-setup for detailed instructions).

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.4169]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 129.0.6668.90
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 129.0.2792.79

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p: url_launcherPlugin to launch external applicationspackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions