Skip to content

relative URI has wrong directory and file values #1341

@inta

Description

@inta

If you create a URI object without a path (e.g. only with query string or fragment identifier), directory and file are not set to the current dir and file name.

// window.location: http://example.com/a/b/c
var uri = new URI('?foo=bar')
uri.get('scheme')    // expected: "http"        actual: "http"
uri.get('host')      // expected: "example.com" actual: "example.com"
uri.get('directory') // expected: "/a/b/"       actual: "/"
uri.get('file')      // expected: "c"           actual: ""

If I read RFC 3986 correctly it should fall back to the current URI.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/35995455-relative-uri-has-wrong-directory-and-file-values?utm_campaign=plugin&utm_content=tracker%2F22069&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F22069&utm_medium=issues&utm_source=github).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions