Skip to content

SDK 36: Linking.parse w/ custom scheme breaks path (uses hostname now) #6497

@bayoremit

Description

@bayoremit

🐛 Bug Report

The new shinny Linking module's parse method in SDK 36 no parses the path for custom schemes properly as documented by (https://docs.expo.io/versions/latest/workflow/linking/) & (#5179)

the path property is now parsed as hostname

Environment

  Expo CLI 3.11.1 environment info:
    System:
      OS: macOS 10.15.1
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
      Yarn: 1.16.0 - /usr/local/bin/yarn
      npm: 6.11.2 - ~/.nvm/versions/node/v10.16.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Android Studio: 3.4 AI-183.5429.30.34.5452501
      Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
    npmGlobalPackages:
      expo-cli: 3.11.1

Steps to Reproduce

Use Linking.parse on these urls

  • lyft://ridetype?id=lyft&pickup[latitude]=37.764728&pickup[longitude]=-122.422999&destination[latitude]=37.7763592&destination[longitude]=-122.4242038
  • myapp://path/into/app?hell
  • custom://my/path?query=param

Expected Behavior

[
    {
        "hostname": null,
        "path": "ridetype",
        "queryParams": {
            "destination[latitude]": "37.7763592",
            "destination[longitude]": "-122.4242038",
            "id": "lyft",
            "pickup[latitude]": "37.764728",
            "pickup[longitude]": "-122.422999"
        },
        "scheme": "lyft"
    },
    {
        "hostname": null,
        "path": "path/into/app",
        "queryParams": {
            "hell": ""
        },
        "scheme": "myapp"
    },
    {
        "hostname": null,
        "path": "my/path",
        "queryParams": {
            "query": "param"
        },
        "scheme": "custom"
    }
]

Actual Behavior

[
    {
        "hostname": "ridetype",
        "path": "",
        "queryParams": {
            "destination[latitude]": "37.7763592",
            "destination[longitude]": "-122.4242038",
            "id": "lyft",
            "pickup[latitude]": "37.764728",
            "pickup[longitude]": "-122.422999"
        },
        "scheme": "lyft"
    },
    {
        "hostname": "path",
        "path": "into/app",
        "queryParams": {
            "hell": ""
        },
        "scheme": "myapp"
    },
    {
        "hostname": "my",
        "path": "path",
        "queryParams": {
            "query": "param"
        },
        "scheme": "custom"
    }
]

Notes

If a 3rd slash is added to the custom schemes, they work as expected. Does this mean this could be a documentation bug from a breaking change?

  • lyft:///ridetype?id=lyft&pickup[latitude]=37.764728&pickup[longitude]=-122.422999&destination[latitude]=37.7763592&destination[longitude]=-122.4242038
  • myapp:///path/into/app?hell
  • custom:///my/path?query=param

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions