Skip to content

fix: encode location query parameter in init request to preserve + (#24089) (CP: 24.10)#24414

Merged
Artur- merged 1 commit into
24.10from
backport-24.10
May 22, 2026
Merged

fix: encode location query parameter in init request to preserve + (#24089) (CP: 24.10)#24414
Artur- merged 1 commit into
24.10from
backport-24.10

Conversation

@Artur-
Copy link
Copy Markdown
Member

@Artur- Artur- commented May 22, 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.

…24089) (CP: 24.10)

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.

(cherry picked from commit adc6694)
@Artur- Artur- requested a review from mcollovati May 22, 2026 08:24
@Artur- Artur- marked this pull request as ready for review May 22, 2026 08:24
@github-actions
Copy link
Copy Markdown

Test Results

1 294 files  +3  1 294 suites  +3   1h 12m 42s ⏱️ - 1m 3s
8 912 tests +1  8 850 ✅ +2  62 💤 ±0  0 ❌ ±0 
9 250 runs  ±0  9 182 ✅ +1  68 💤 ±0  0 ❌ ±0 

Results for commit 50fad2c. ± Comparison against base commit bce9f25.

@sonarqubecloud
Copy link
Copy Markdown

@mcollovati
Copy link
Copy Markdown
Collaborator

@Artur- needs to be picked into 24.9 as well?

@Artur-
Copy link
Copy Markdown
Member Author

Artur- commented May 22, 2026

Yes, the original PR was made there

@Artur- Artur- merged commit d8b2e94 into 24.10 May 22, 2026
27 of 28 checks passed
@Artur- Artur- deleted the backport-24.10 branch May 22, 2026 09:15
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