Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
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

Description

@markewallace

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?

Activity

  1. ctaleck commented on Mar 1, 2019

    @ctaleck

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions