Skip to content

router.resolve did not handle <base> correctly #3819

Closed
@ichaoX

Description

@ichaoX

Version

3.6.5

Reproduction link

5s3iuf.csb.app/root/main.html

Steps to reproduce

Click on Link A or open Link B in a new tab.

And check the generated href attribute in the inspector.

What is expected?

In hash mode, the following results are logical, I would prefer the last one, because the HashHistory is not related to the baseURI and the availability of the <base> source is unknown.

// "https://example.com/root/rel/path#/bar"
new URL("#/bar",document.baseURI).href

// "https://example.com/root/main.html#/bar"
new URL("#/bar",location).href
// If location.href and document.baseURI are same-origin or both paths are the same, 
// it is possible to slice the generated URL to shorten it.

What is actually happening?

The generated href attributes are all "/./rel/path#/foo/#/bar".

Both the relative path and the hash of Link A are not handled correctly.

Link B has the same issue when opened in a new tab.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions