Skip to content

[9.3] [Console] Preserve spaces in URL query strings (#270881)#271189

Merged
kibanamachine merged 1 commit into
elastic:9.3from
kibanamachine:backport/9.3/pr-270881
May 26, 2026
Merged

[9.3] [Console] Preserve spaces in URL query strings (#270881)#271189
kibanamachine merged 1 commit into
elastic:9.3from
kibanamachine:backport/9.3/pr-270881

Conversation

@kibanamachine
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.3:

Questions ?

Please refer to the Backport tool documentation

Closes elastic#227733

## Summary

- Preserves unquoted spaces in Console URL query values instead of
treating them as request-line trailing text.
- Keeps inline `//` and `#` comment stripping for request URLs.
- Adds focused edge-case coverage for the helper and the full
`parseLine` request-line path.

## Root Cause

- `removeTrailingWhitespaces` stopped at the first unquoted space, so
`GET myindex/_search?q=type:organisation AND elastic` was truncated
before `AND elastic`.

## Fix

- Use the first `?` outside quotes as the query-string boundary.
- Preserve spaces inside query values unless the space starts a trailing
inline `//` or `#` comment.
- Preserve the existing leading-space behavior and ignore comment
markers inside quoted query values.

## Before
<img width="1494" height="1313" alt="image"
src="https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823"
/>

## After
<img width="1482" height="1365" alt="image"
src="https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95"
/>

## Test Plan

- [x] `node scripts/jest
src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`
- [x] `node scripts/eslint
src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts
src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`
- [x] `node scripts/type_check --project
src/platform/plugins/shared/console/tsconfig.json`
- [x] `node scripts/check_changes.ts`
- [x] Manually verified in Console that unquoted query spaces are
preserved, trailing `//` and `#` comments are stripped, comment markers
inside quoted query values are preserved, quoted `?` path text is not
treated as the query delimiter, and trailing non-query text is trimmed
before sending the request.

Assisted with Cursor using GPT-5.5

Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit 9d7d161)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label May 26, 2026
@kibanamachine kibanamachine enabled auto-merge (squash) May 26, 2026 08:28
@kibanamachine
Copy link
Copy Markdown
Contributor Author

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
console 202.5KB 202.9KB +319.0B

cc @kapral18

@kibanamachine kibanamachine merged commit 3e5ff2b into elastic:9.3 May 26, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants