Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency for "dbname" with relative filenames #8

Closed
Grinnz opened this issue Sep 20, 2015 · 2 comments
Closed

Inconsistency for "dbname" with relative filenames #8

Grinnz opened this issue Sep 20, 2015 · 2 comments

Comments

@Grinnz
Copy link

Grinnz commented Sep 20, 2015

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.

@theory
Copy link
Collaborator

theory commented Sep 21, 2015

I think that fixes the issue, @Grinnz. It's a bit funky parsing the URI to figure this stuff out.

@Grinnz
Copy link
Author

Grinnz commented Sep 21, 2015

Looks good to me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants