spring-projects / spring-projects/spring-hateoas

HalLinkDiscoverer doesn't decode '+' in a param of GET request

Open
#681 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
476
PR merge metrics
No merged PRs in 30d

Description

Sample code:

    Map<String, Object> params = new HashMap<>();
    params.put("name", name);

    HalLinkDiscoverer linkDiscoverer = new HalLinkDiscoverer();
    Link link = linkDiscoverer.findLinkWithRel(IS_NAME_TAKEN_REL, getSearchLinks()).expand(params);

In a debug session I see the results as follows:

  1. http://localhost:8080/server/api/search/isNameTaken?name=777%20777;rel="isNameTaken" for "777 777"
    Space becomes "%20" which is in line with RFC https://www.w3schools.com/tags/ref_urlencode.asp
  2. http://localhost:8080/server/api/search/isNameTaken?name=777+777;rel="isNameTaken" for "777+777"
  • is supposed to become "%2B"
    Tested against version 0.24.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with HalLinkDiscoverer and the Link.expand(params) entry point, tracing how GET query parameters are encoded. Reproduce the two examples from the issue and verify that a literal plus is encoded distinctly from a space while the existing link expansion behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.