Skip to content

Commit 85f5361

Browse files
committed
Fix to be available file:/// or file://localhost formatted URI.
1 parent dd46c71 commit 85f5361

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ext/pdo_sqlite/sqlite_driver.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,17 @@ static const struct pdo_dbh_methods sqlite_methods = {
735735
static char *make_filename_safe(const char *filename)
736736
{
737737
if (*filename && strncasecmp(filename, "file:", 5) == 0) {
738-
char *fullpath = expand_filepath(filename+5, NULL);
738+
char *fullpath;
739+
if (strncasecmp(filename+5, "///", 3) == 0) {
740+
fullpath = expand_filepath(filename+7, NULL);
741+
} else if (strncasecmp(filename+5, "//localhost/", 12) == 0) {
742+
fullpath = expand_filepath(filename+16, NULL);
743+
} else if (strncasecmp(filename+5, "//", 2) == 0) {
744+
// authority error on sqlite3_open_v2
745+
return filename;
746+
} else {
747+
fullpath = expand_filepath(filename+5, NULL);
748+
}
739749

740750
if (!fullpath) {
741751
return NULL;

0 commit comments

Comments
 (0)