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

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

Open
anayw2001 opened this issue Nov 15, 2024 · 1 comment · May be fixed by flutter/packages#8107
Open

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

anayw2001 opened this issue Nov 15, 2024 · 1 comment · May be fixed by flutter/packages#8107
Labels
p: url_launcher Plugin to launch external applications package flutter/packages repository. See also p: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@anayw2001
Copy link

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.
@anayw2001 anayw2001 linked a pull request Nov 15, 2024 that will close this issue
11 tasks
@anayw2001 anayw2001 changed the title [url_launcher_windows] URL logged on error is wrong [url_launcher] URL logged on error is wrong on Windows Nov 16, 2024
@stuartmorgan
Copy link
Contributor

Expected results

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

Could you elaborate on why you are expecting this? The title describes the current behavior as "wrong", but what's currently happening is that you are calling launchUrl with a URL, and when it fails you get an exception saying that URL couldn't be launched, which seems like reasonable behavior (and IIRC is consistent with the other platforms).

What is the underlying problem you are trying to solve by changing this behavior? Did the use of the URL you provided in the exception cause issues in your debugging or error handling?

@stuartmorgan stuartmorgan added waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds p: url_launcher Plugin to launch external applications package flutter/packages repository. See also p: labels. labels Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: url_launcher Plugin to launch external applications package flutter/packages repository. See also p: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants