Commit 9d7d161
[Console] Preserve spaces in URL query strings (#270881)
Closes #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>1 parent 1e9a37a commit 9d7d161
2 files changed
Lines changed: 130 additions & 20 deletions
File tree
Lines changed: 73 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
34 | 82 | | |
35 | 83 | | |
36 | 84 | | |
| |||
48 | 96 | | |
49 | 97 | | |
50 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
51 | 117 | | |
52 | 118 | | |
53 | 119 | | |
| |||
197 | 263 | | |
198 | 264 | | |
199 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
200 | 273 | | |
201 | 274 | | |
Lines changed: 57 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
412 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
413 | 415 | | |
414 | | - | |
| 416 | + | |
| 417 | + | |
415 | 418 | | |
416 | 419 | | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
| 420 | + | |
| 421 | + | |
430 | 422 | | |
431 | | - | |
432 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
433 | 445 | | |
| 446 | + | |
434 | 447 | | |
435 | 448 | | |
436 | 449 | | |
| |||
476 | 489 | | |
477 | 490 | | |
478 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
479 | 516 | | |
480 | 517 | | |
481 | 518 | | |
| |||
0 commit comments