Skip to content

Router ignores deeplink URL part after #: http://baseUrl/#token=xyz  #80666

Closed
flutter-team-archive/engine
#26185

Description

@nstrelow

I am using Navigator 2.0/Router.
parseRouteInformation from RouteInformationParser ignores everything after a #. My backend (supabase) provides tokens via a URL with /#token=xyz.

Ref in gotrue-dart: supabase/gotrue-dart#12

This happens both on Flutter web and(only when using pathUrlStrategy) using deeplinking on Android.

Is there a way to read everything that comes after the # or do not cut it off? I could not find the code part where it is cut off.

flutter doctor -v

[✓] Flutter (Channel beta, 2.2.0-10.1.pre, on Microsoft Windows [Version 10.0.21359.1], locale de-DE)
    • Flutter version 2.2.0-10.1.pre at C:\Users\nilss\flutter
    • Framework revision 0941968447 (3 days ago), 2021-04-15 12:01:02 -0700
    • Engine revision d2a2e93510
    • Dart version 2.13.0 (build 2.13.0-211.6.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\nilss\AppData\Local\Android\Sdk
    • Platform android-S, build-tools 30.0.3
    • ANDROID_HOME = C:\Users\nilss\AppData\Local\Android\Sdk
    • Java binary at: C:\Users\nilss\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\202.7231092\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
    • All Android licenses accepted.

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

[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.4)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.9.31205.134
    • Windows 10 SDK version 10.0.19041.0

[✓] Android Studio
    • Android Studio at C:\Users\nilss\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\202.7231092
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 202.8346
    • android-studio-dir = C:\Users\nilss\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\202.7231092
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)

[✓] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 11 (API 30) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.21359.1]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 89.0.4389.128
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 89.0.774.77

• No issues found!

Activity

  1. iapicca commented on Apr 18, 2021

    @iapicca

    @nstrelow
    can you provide your flutter doctor -v, your flutter run -d chrome -v and a minimal reproducible code sample without 3rd party plugins

  2. nstrelow commented on Apr 18, 2021

    @nstrelow
    ContributorAuthor

    Hehe, tried to make an failing example and got a working one for web
    Web is working using the baseUrl/#/#testFragment notation.

    But Android is still not working and stripping #testFragement when using deeplinks. Will upload example code shortly.

  3. changed the title [-]Router ignores URL part after #: http://baseUrl/#token=xyz[/-] [+]Router ignores URL part after #: http://baseUrl/#token=xyz on Android[/+] on Apr 18, 2021
  4. nstrelow commented on Apr 18, 2021

    @nstrelow
    ContributorAuthor

    Minimal example for Android Deeplink stripping away URL fragment baseUrl/#something: https://github.com/nstrelow/flutter_failing_fragment_deeplink

    Run example on Android and execute this:

    adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://test-deeplink-url-fragment.com/#testFragment"
    
  5. added
    in triage
    on Apr 19, 2021
  6. pedromassangocode commented on Apr 19, 2021

    @pedromassangocode

    The issue seems to be caused by the #. If you remove it then the argument is passes properly.

    Example: this url works:
    adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://test-deeplink-url-fragment.com/testFragment=0"

    flutter doctor -v
    [✓] Flutter (Channel stable, 2.0.5, on macOS 11.2.3 20D91 darwin-x64, locale en-AO)
        • Flutter version 2.0.5 at /Users/pedromassango/Code/flutter_stable
        • Framework revision adc687823a (3 days ago), 2021-04-16 09:40:20 -0700
        • Engine revision b09f014e96
        • Dart version 2.12.3
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
        • Android SDK at /Users/pedromassango/Library/Android/sdk
        • Platform android-30, build-tools 30.0.2
        • ANDROID_HOME = /Users/pedromassango/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
        • All Android licenses accepted.
    
    [!] Xcode - develop for iOS and macOS
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.4, Build version 12D4e
        ! CocoaPods 1.9.3 out of date (1.10.0 is recommended).
            CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
            Without CocoaPods, plugins will not work on iOS or macOS.
            For more info, see https://flutter.dev/platform-plugins
          To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    
    [✓] IntelliJ IDEA Community Edition (version 2021.1)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 55.1.5
        • Dart plugin version 211.6693.108
    
    [✓] VS Code (version 1.55.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.16.0
    
    [✓] Connected device (3 available)
        • sdk gphone x86 64 (mobile) • emulator-5554 • android-x64    • Android 11 (API 30) (emulator)
        • macOS (desktop)            • macos         • darwin-x64     • macOS 11.2.3 20D91 darwin-x64
        • Chrome (web)               • chrome        • web-javascript • Google Chrome 89.0.4389.128
    
    ! Doctor found issues in 1 category.
  7. added
    f: routes
    found in release: 2.1
    framework
    has reproducible steps
    and removed
    in triage
    on Apr 19, 2021
  8. changed the title [-]Router ignores URL part after #: http://baseUrl/#token=xyz on Android[/-] [+]Router ignores deeplink URL part after #: http://baseUrl/#token=xyz on Android [/+] on Apr 19, 2021
  9. nstrelow commented on Apr 19, 2021

    @nstrelow
    ContributorAuthor

    @pedromassango Yes, the problem is the #.

    But my backend (supabase) returns URLs in this format, which I do not have control over.
    Also URI fragments are actually used in client applications.

    It's just unfortunate that Android does strip it away, but web doesn't.

  10. goderbauer commented on Apr 21, 2021

    @goderbauer
    Member

    /cc @chunhtai Do you know why we would ignore the fragment?

  11. chunhtai commented on Apr 21, 2021

    @chunhtai
    Contributor

    Yes we forgot to include the URI fragment, it is the same thing for iOS as well.

  12. added
    platform-android
    engine
    platform-ios
    on Apr 21, 2021
  13. changed the title [-]Router ignores deeplink URL part after #: http://baseUrl/#token=xyz on Android [/-] [+]Router ignores deeplink URL part after #: http://baseUrl/#token=xyz [/+] on Apr 22, 2021
  14. added
    P2
    on Apr 26, 2021
  15. nstrelow commented on May 8, 2021

    @nstrelow
    ContributorAuthor

    Friendly grateful bump.

    Or some pointers where that piece of code lies around? Could try to fix it and make a PR

  16. github-actions commented on Jul 30, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  17. locked as resolved and limited conversation to collaborators on Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2enginef: routesfound in release: 2.1frameworkhas reproducible stepsplatform-androidplatform-ios

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions