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.

LocationHtml5Url search() returns undefined if server rewrites base URL #11223

Closed
@akerfoot

Description

@akerfoot

Hi,

I encountered a problem where if the server rewrites part of the baseHref, the LocationHtml5Url $location.search() will return undefined, instead of an empty object.

For example, if I request: http://www.example.com/Username

and the server rewrites it as http://www.example.com/username

when the LocationProvider.$get calls $$parseLinkUrl, it doesn't call $$parse like it normally would, which would call parseAppUrl and set locationObj.$$search.

Since $$parseLinkUrl is comparing the rewritten appBase (http://www.example.com/username) against the requested initialUrl (http://www.example.com/Username), the beginsWith check fails and it doesn't follow the same code path as if the url hadn't been rewritten.

I can't say I'm familiar enough with the code to suggest a fix, but it seems like parseAppUrl sets up important state for the $location service, and not calling it during instantiation causes problems.

EDIT: forgot to mention, I encountered this running angular-1.3.6.js.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions