Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

parseUrl cannot handle URI's contain the @ symbbol #232

Open
markewallace opened this issue Feb 15, 2019 · 1 comment
Open

parseUrl cannot handle URI's contain the @ symbbol #232

markewallace opened this issue Feb 15, 2019 · 1 comment

Comments

@markewallace
Copy link

I've run into an issue where I need to change my applications behaviour so that it works with both the in memory service and the real API.

Here is the scenario:

  1. We have a API that supports searching for users by email so we could call it something like this http://localhost:4200/api/[email protected]
  2. When running with the in memory service I have to encode the query parameter
  3. But if I do that when running with the real API I end up with the query parameter value being doubly encode

The problem seems to be in the parseUri method.

Here's a single example I created to reproduce the issue: https://stackblitz.com/edit/angular-nckow7

This is how the URI get's parsed

{
    "source": "http://localhost:4200/api/[email protected]",
    "protocol": "http",
    "authority": "localhost:4200/api/[email protected]",
    "userInfo": "localhost:4200/api/search?query=foo",
    "user": "localhost",
    "password": "4200/api/search?query=foo",
    "host": "bar.com",
    "port": "",
    "relative": "",
    "path": "",
    "directory": "",
    "file": "",
    "query": "",
    "anchor": ""
}

According to the RFC 3986 the @ symbol is valid, see: https://stackoverflow.com/questions/1547899/which-characters-make-a-url-invalid/1547940#1547940

Is this a valid defect?

@ctaleck
Copy link

ctaleck commented Mar 1, 2019

It is valid because it designates the start of the "password" param. Try encoding the @ as %40 if you want to use it in the "query" param.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants