Skip to content
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

fix: Make URLUtil.encodeURI behave like encodeURI in JavaScript and add encodeURIComponent #12291

Merged
merged 1 commit into from Nov 8, 2021

Conversation

Artur-
Copy link
Member

@Artur- Artur- commented Nov 5, 2021

No description provided.

@vaadin-bot
Copy link
Collaborator

SonarQube analysis reported 2 issues

  1. MINOR LocationUtil.java#L173: Replace this if-then-else statement by a single return statement. rule
  2. MINOR LocationUtil.java#L173: Move the ".." string literal on the left side of this string comparison. rule

@Artur- Artur- changed the title fix: Make URLUtil behave like encodeURI in JavaScript fix: Make URLUtil.encodeURI behave like encodeURI in JavaScript and add encodeURIComponent Nov 5, 2021
URI uri = new URI(UrlUtil.encodeURI(strippedPath));
// : is completely valid in a path but URI will think that defines a
// protocol so skip it for the check
URI uri = new URI(UrlUtil.encodeURI(strippedPath).replace(":", ""));
if (uri.isAbsolute()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the initial check un-necessary as we can never have a uri with a scheme at this point?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would seem so if we first remove : and then check for :

Let's fix in a separate PR

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with platform 22.0.0.beta2 and is also targeting the upcoming stable 22.0.0 version.

joheriks pushed a commit that referenced this pull request Feb 3, 2022
joheriks pushed a commit that referenced this pull request Feb 3, 2022
joheriks pushed a commit that referenced this pull request Feb 4, 2022
joheriks pushed a commit that referenced this pull request Feb 4, 2022
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with platform 14.8.4.

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

Successfully merging this pull request may close these issues.

None yet

3 participants