spring-projects / spring-projects/spring-data-rest

Special character in entity ID leads to invalid self link [DATAREST-447]

Open
#826 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Glenn Boschmans opened DATAREST-447 and commented

In my current project IDs of a certain entity need to have special characters like "§". When you traverse the entities the self url of an entity with a special character will become an invalid one where the /{collectionpath}/{entityId} is replicated.

In the GitHub repository you can find a project that reproduces the issue.

When starting the server go to http://localhost:9666/testcases/ to see all the test cases. There the self link for each entity is still ok (note: the special characters are escaped). Once you traverse to one of the testcases with a special character, you will see that the JSON will be something in the likes of the following.

{
"id": "3§1A",
"someStuff": "look at my wrong self link",
"_links": {
"self": {
"href": "http://localhost:9666/testcases/3%C2%A71A/testcases/3%C2%A71A"
}
}
}

For the testcase with id "OK" the JSON response is correct.

{
"id": "OK",
"someStuff": "no issue here",
"_links": {
"self": {
"href": "http://localhost:9666/testcases/OK"
}
}
}


Reference URL: https://github.com/GlennBoschmans/data-rest-special-char

Referenced from: pull request https://github.com/GlennBoschmans/data-rest-special-char

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.