Skip to content

Differently encoded URLs in self and first links #1525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
max-maurice opened this issue Apr 8, 2024 · 1 comment · Fixed by #1526
Closed

Differently encoded URLs in self and first links #1525

max-maurice opened this issue Apr 8, 2024 · 1 comment · Fixed by #1526
Labels

Comments

@max-maurice
Copy link

DESCRIPTION

In the links section of a response, the URL values for self and first are encoded differently.

STEPS TO REPRODUCE

  1. Request a resource and include a filter query, where one constant expression contains a space character: http://localhost/api/items?filter=equals(city,'New York')
  2. The response looks like this:
    {
        "data": [
        ],
        "links": {
            "first": "http://localhost/api/items?filter=equals(city,%27New York%27)",
            "self": "http://localhost/api/items?filter=equals(city,%27New%20York%27)"
        },
        "meta": {
            "docs": "/swagger/index.html"
        }
    }

EXPECTED BEHAVIOR

Links are encoded the same way in all link URLs, where a space character is output as %20 just like in the self field.

ACTUAL BEHAVIOR

Links in the first and next field, and presumably in others too, are not entirely url-encoded.

VERSIONS USED

  • JsonApiDotNetCore version: 5.5.1
  • ASP.NET Core version: .Net 7.0.15
  • Entity Framework Core version: 7.0.15
  • Database provider: SqlServer
@bkoelman
Copy link
Member

bkoelman commented Apr 8, 2024

Hi @max-maurice, thanks for reaching out. I can reproduce the problem and was surprised by this behavior, which comes from the built-in Uri class in .NET that we use here. I've created dotnet/runtime#100792 to investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants