Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

html5 mode with mismatching base href causes "TypeError: Cannot read property 'replace' of undefined" error in location.js #13565

Closed
@jamlee1

Description

@jamlee1

Looking at the latest version of location.js (https://github.com/angular/angular.js/blob/4412fe238f37f79a2017ee7b20ba089c0acd73e9/src/ng/location.js)

If the tag does not match the actual href, $$parseLinkUrl will miss all the conditions and rewrittenUrl will not be defined, which means this.$$parse will not be called and $$absUrl will not be set.

Later on line 902 (

if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {
), trimEmptyHash($location.absUrl()) will be called in a condition, which will end up having trimEmptyHash call .replace on undefined, so we end up halting with:

TypeError: Cannot read property 'replace' of undefined

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions