Skip to content

Problem with encodeURI with forward-slash in path param #29

Description

@shashanka-wings

I have a url

/api/namespace/{namespace}?query={query}

namespace path param value is AWS/EC2 (please note forward slash '/' in path param)

Now the issue is:

  1. fetch-plus uses encodeURI (see this line in fetch-plus)

path = normalizeFunc(path.map(compute).map(encodeURI).join("/"));

So this escapes forward-slash, and hence the resulting url from fetch-plus is invalid

/api/namespace/AWS/EC2?query=1

  1. If I use encodeURIComponent for the path param myself before passing to fetch-plus,
    encodeURIComponent('AWS/EC2') = AWS%2FEC2

valid path before fetch-plus:
/api/namespace/AWS%2FEC2?query=1

path converted in fetch-plus:
/api/namespace/AWS%252F?query=1

Notice that %2F is converted to %252F which is wrong. This is because of encodeURI.

So we cannot use fetch-plus in this scenario.

Please take a look.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions