Skip to content

Inconsistency for "dbname" with relative filenames #8

Closed
@Grinnz

Description

@Grinnz

There seems to be a bit of an inconsistency between a SQLite URI with a host specified and one with an empty authority, if the "dbname" section does not start with a /. I'm not sure how best to explain it so here are some examples.

$ perl -MURI::db -E'say URI->new("db:sqlite:///foo.db")->dbname'
/foo.db

$ perl -MURI::db -E'say URI->new("db:sqlite://localhost/foo.db")->dbname'
foo.db

$ perl -MURI::db -E'say URI->new("db:sqlite:////foo.db")->dbname'
/foo.db

$ perl -MURI::db -E'say URI->new("db:sqlite://localhost//foo.db")->dbname'
/foo.db

$ perl -MURI::db -E'my $uri = URI::db->new("sqlite://"); $uri->dbname("foo.db"); say $uri'
db:sqlite:///foo.db

The last example is an odd case where setting dbname results in getting a different dbname back, because sqlite:///foo is interpreted as an absolute file path.

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