llfbandit / app_links

Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler for Flutter.
https://pub.dev/packages/app_links
Apache License 2.0
176 stars 68 forks source link

Incompatibility with Android Slack ACTION_VIEW content URI #5

Closed espresso3389 closed 3 years ago

espresso3389 commented 3 years ago

This is ultimately not an issue with the plugin but Slack Android app send ACTION_VIEW with URIs like content://com.Slack.fileprovider/slack_files/xxx.jpg. The URI hostname has capitalized S in it and Dart's Uri constructor make the hostname lower-case during processing it.

As the result, the app receives content://com.slack.fileprovider/slack_files/xxx.jpg and it cannot resolve the content with the lower-cased URI.

I need some workaround not to use Uri.parse or... something special to handle such problematic URI.

llfbandit commented 3 years ago

Unfortunately, there's no workaround to this but making a breaking change to provide the value as String.

But I'm not sure to get your point. Apparently, you get called back by the package with a lowercased value, didn't you? If so, you can already process it, why couldn't you?

espresso3389 commented 3 years ago

Apparently, you get called back by the package with a lowercased value, didn't you? If so, you can already process it, why couldn't you?

For me, if there would be another version of AppLinks constructor/factory that accepts a function with String parameter, it's completely acceptable. Otherwise, I will do some of so much ugly (and not complete) workaround like the following fragment:

_appLinks = AppLinks(onAppLink: (uri) async {
      // very ugly workaround to recover Slack's original URI:
      final uriStr = uri.toString().replaceFirst('content://com.slack.fileprovider/', 'content://com.Slack.fileprovider/');
      ...
    });
llfbandit commented 3 years ago

This is now available in version 2.1.0