Skip to content

parseLocation doesn't handle base href values that are not "/" #54

@justinrassier

Description

@justinrassier

The infrastructure I work with can't have a simple <base href="/"> but has to have a value such as <base href="/context/apps/my-elm-app/">

This changes the parsing logic when setting up route matchers. To get the routing to work, you have to have all the segments that are included in the base href value such as:

matchers : Parser (Route -> a) a
matchers =
    oneOf
        [ UrlParser.map Master top
        , UrlParser.map Master (UrlParser.s "context" </> s "apps" </> s "my-elm-app" </> s "master")
        , UrlParser.map Detail (s "context" </> s "apps" </> s "my-elm-app" </> s "detail" </> int)
        ]

I would expect that the path parsing would start at the segments starting after the base href value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions