Skip to content

Malformed document page when URL query contains slash #2214

Open
@aplhk

Description

@aplhk

I came across a few links from Google search and found out that precedence of slash (/) in the URL query string will lead to malformed / unresponsive document page.

Example of malformed page: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html?example.com/a

I believe the root cause is in the TOC fetching script:

var url = location.href.replace(/[^\/]+$/, 'toc.html');
var toc = $.get(url, {}, function(data) {
right_col.append(data);
init_toc(LangStrings);
utils.open_current(location.pathname);
}).always(function() {
init_headers(right_col, LangStrings);
});

In this case location.href is https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html?example.com/a, and after replacing the string it will fetch and append https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html?example.com/toc.html which causes infinite loop and unresponsive page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that does not look or behave correctly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions