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

Navigation issues with percent sign in names #82440

Open
yuliacech opened this issue Nov 3, 2020 · 8 comments
Open

Navigation issues with percent sign in names #82440

yuliacech opened this issue Nov 3, 2020 · 8 comments
Labels
bug Fixes for quality problems that affect the customer experience Feature:ILM Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more

Comments

@yuliacech
Copy link
Contributor

yuliacech commented Nov 3, 2020

Kibana version:
Current master branch

Describe the bug:
Navigation doesn't work correctly for resources with names containing percent sign with other special characters or containing %25 sequence. The issue occurs in plugins:

  • ILM
  • Index Management

The issue occurs because history package (react-router dependency) uses decodeURI on the url and only happens when the user reloads a page or navigates from outside of Kibana via a deep link. The issue doesn't happen when navigating inside Kibana with react-router when encodeURI is used on the url.

Explanation of match params decoding in react-router
const policyName = 'test%#';
const url = encodeURI(`/policies/edit/${encodeURIComponent(policyName)}`); 
// url is '/policies/edit/test%2525%2523' (double decoding)
reactRouterNavigate(url);
  1. decodeURI is called internally in react-router/history package
  2. address bar is set to test%25%23
  3. match params coming from react-router is set to test%25%23
  4. encodeURIComponent('test%25%23') is used in components getting match params from react-router to get the correct policyName test%#.

When the user reloads the page, react-router decodes the value coming from the address bar:

  1. decodeURI('test%25%23') results in match params set to test%%23
  2. calling encodeURIComponent('test%%23') throws an URIError, so using match params directly results in the wrong policy name test%%23.

The issue might be fixed once react-router is updated to v6 (which uses history v5).

Related history packages issues: 505, 777, 786

Steps to reproduce:

  • ILM
  1. Create a policy with the name test%25 or test%# and click 'save' button.
  2. In the policies table, click on the newly created policy to navigate to the edit page.
  3. Reload the edit page, the name of the policy will be test% (not test%25) or test%%23 (not test%#).
  • Index Management (index templates tab)
  1. Create an index template with the name test%25 or test%#
  2. After saving, the app will redirect to index templates table with a detail flyout displaying the newly created index template.
  3. Reload the page, the name of the template will be test% (not test%25) or test%%23 (not test%#).
Screenshot Screenshot 2020-11-03 at 14 59 08
@yuliacech yuliacech added bug Fixes for quality problems that affect the customer experience Feature:ILM Feature:Index Management Index and index templates UI Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Nov 3, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

@cjcenizal cjcenizal changed the title Navigation issues with dollar sign in names Navigation issues with percent sign in names Nov 3, 2020
@legrego
Copy link
Member

legrego commented Nov 17, 2020

We've also encountered this on the User management screen: #83541

@cee-chen
Copy link
Member

Just ran into this exactly as well with the Enterprise Search plugin. FYI that this % decoding issue does not occur for us in our standalone React app that is also on React Router 5.2.0 (although our history dependency is on 4.5.1 vs Kibana's 4.9.0 - maybe that's why?) Super odd either way - definitely ping us if we can help at all (although those RR issues look gnarly, so maybe not :)

@cee-chen
Copy link
Member

cee-chen commented Jan 21, 2021

Just heard back from @yakhinvadim on this - it turns out that the reason is indeed because we pinned history to 4.5.1:

We fixated history version to 4.5.1 to not use the new "Encode/decode URLs" feature that was added in history v4.6.0.
That new feature was eventually removed in this PR. Maintainers decided to release it in a new major. According to roadmap they plan to release it in 5.0. At the time of writing this comment, 5.0 is still in beta, so we can't update the "history" package right now.

Not sure how debilitating this issue is for y'all, but it might be worth considering pinning history to 4.5.1 (unless there is some functionality Kibana specifically needs from 4.6+) to fix this issue.

@legrego
Copy link
Member

legrego commented May 20, 2022

#132600 is tracking the work to upgrade the history package to 5.0, which will hopefully resolve this issue for us.

@TinaHeiligers
Copy link
Contributor

FYI, there's a workaround that we could investigate if the effort involved to upgrade remains blocking.

@yuliacech
Copy link
Contributor Author

We encountered this issue again while adding a new index details page (see #166100). A workaround that we use is to replace the url segment with a query parameter: /indices/${indexName} -> /indices/index_details?indexName=${indexName} (#166882).

@alisonelizabeth alisonelizabeth removed the Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more label Sep 16, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Sep 16, 2024
@alisonelizabeth alisonelizabeth added the Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more label Sep 16, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Sep 16, 2024
@alisonelizabeth alisonelizabeth removed the Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more label Sep 17, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Sep 17, 2024
@alisonelizabeth alisonelizabeth added Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more and removed Feature:Index Management Index and index templates UI needs-team Issues missing a team label labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:ILM Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet
Development

No branches or pull requests

6 participants