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

Better handling of calls to RepositoryEntityLinks.slash(…) [DATAREST-76]

Open
#461 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Oliver Drotbohm opened DATAREST-76 and commented

Currently the implementation of RepositoryEntityLinks.slash(…) has a few shortcomings. It currently uses builder.pathSegment(…) which means that Strings starting with a slash will be prepended as is. This might result in duplicate slashes and query parameters and fragment included in the given String not discovered as such.

It's probably better to build a UriComponents from the String representation of the given object and add the relevant parts to the current builder:

UriCopmponents components = UriComponentsBuilder.fromUriString(path).build();
for (String pathSegment : components.getPathSegments()) {
  builder.pathSegment(pathSegment);
}

builder.query(components.getQuery());
builder.fragments(components.getFragment());

No further details from DATAREST-76

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.

Research direction

Start at RepositoryEntityLinks.slash(…) and trace its current pathSegment handling, then inspect the UriComponents and UriComponentsBuilder APIs mentioned in the issue. Done means leading slashes do not create duplicates and query parameters and fragments in the supplied String are handled separately by the resulting URI.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
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.