Skip to content

fix: encode location query parameter in init request to preserve +#24089

Merged
mcollovati merged 4 commits into
mainfrom
plus-in-route
Apr 8, 2026
Merged

fix: encode location query parameter in init request to preserve +#24089
mcollovati merged 4 commits into
mainfrom
plus-in-route

Conversation

@Artur-
Copy link
Copy Markdown
Member

@Artur- Artur- commented Apr 7, 2026

Re-add encodeURIComponent() around the location parameter in the init request query string. Without encoding, a literal + in the URL path (e.g. /+/dashboard) is interpreted as a space by the servlet container's query parameter decoding, resulting in InvalidLocationException: Relative path cannot start with /

The encodeURIComponent was removed in #22791 to preserve %2F in wildcard parameters, but this is not needed: double-encoding (%2F becomes %252F) is correctly undone by the servlet's single query parameter decode.

Artur- added 2 commits April 7, 2026 15:56
Adds a view with @route(":tenant/plus-test") and an IT that navigates
to /+/plus-test to verify that a literal + as the first path segment
is preserved as a route parameter value.
Re-add encodeURIComponent() around the location parameter in the
init request query string. Without encoding, a literal + in the URL
path (e.g. /+/dashboard) is interpreted as a space by the servlet
container's query parameter decoding, resulting in
InvalidLocationException: Relative path cannot start with /

The encodeURIComponent was removed in #22791 to preserve %2F in
wildcard parameters, but this is not needed: double-encoding (%2F
becomes %252F) is correctly undone by the servlet's single query
parameter decode.
@github-actions github-actions Bot added the +0.0.1 label Apr 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

Test Results

 1 390 files  +3   1 390 suites  +3   1h 24m 28s ⏱️ + 1m 12s
 9 939 tests +1   9 868 ✅ +1  71 💤 ±0  0 ❌ ±0 
10 414 runs  +3  10 334 ✅ +3  80 💤 ±0  0 ❌ ±0 

Results for commit a872fe2. ± Comparison against base commit 068aaa2.

♻️ This comment has been updated with latest results.

mcollovati
mcollovati previously approved these changes Apr 8, 2026
Copy link
Copy Markdown
Collaborator

@mcollovati mcollovati left a comment

Choose a reason for hiding this comment

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

Just a comment on the test view, but the fix looks good.

@mcollovati mcollovati enabled auto-merge April 8, 2026 13:23
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 8, 2026

@mcollovati mcollovati added this pull request to the merge queue Apr 8, 2026
Merged via the queue into main with commit adc6694 Apr 8, 2026
31 checks passed
@mcollovati mcollovati deleted the plus-in-route branch April 8, 2026 13:49
@vaadin-bot
Copy link
Copy Markdown
Collaborator

Hi @Artur- and @mcollovati, when i performed cherry-pick to this commit to 24.10, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick adc6694
error: could not apply adc6694... fix: encode location query parameter in init request to preserve + (#24089)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

vaadin-bot added a commit that referenced this pull request May 22, 2026
…24089) (CP: 25.1) (#24410)

This PR cherry-picks changes from the original PR #24089 to branch 25.1.
---
#### Original PR description
> Re-add encodeURIComponent() around the location parameter in the init
request query string. Without encoding, a literal + in the URL path
(e.g. /+/dashboard) is interpreted as a space by the servlet container's
query parameter decoding, resulting in InvalidLocationException:
Relative path cannot start with /
> 
> The encodeURIComponent was removed in #22791 to preserve %2F in
wildcard parameters, but this is not needed: double-encoding (%2F
becomes %252F) is correctly undone by the servlet's single query
parameter decode.
>

Co-authored-by: Artur Signell <artur@vaadin.com>
Artur- added a commit that referenced this pull request May 22, 2026
…24089) (CP: 24.10) (#24414)

Re-add encodeURIComponent() around the location parameter in the init
request query string. Without encoding, a literal + in the URL path
(e.g. /+/dashboard) is interpreted as a space by the servlet container's
query parameter decoding, resulting in InvalidLocationException:
Relative path cannot start with /

The encodeURIComponent was removed in #22791 to preserve %2F in wildcard
parameters, but this is not needed: double-encoding (%2F becomes %252F)
is correctly undone by the servlet's single query parameter decode.
vaadin-bot added a commit that referenced this pull request May 22, 2026
…24089) (CP: 24.10) (#24414) (CP: 24.9) (#24419)

This PR cherry-picks changes from the original PR #24414 to branch 24.9.
---
#### Original PR description
> Re-add encodeURIComponent() around the location parameter in the init
request query string. Without encoding, a literal + in the URL path
(e.g. /+/dashboard) is interpreted as a space by the servlet container's
query parameter decoding, resulting in InvalidLocationException:
Relative path cannot start with /
> 
> The encodeURIComponent was removed in #22791 to preserve %2F in
wildcard parameters, but this is not needed: double-encoding (%2F
becomes %252F) is correctly undone by the servlet's single query
parameter decode.
>

Co-authored-by: Artur Signell <artur@vaadin.com>
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.

3 participants