Skip to content

Commit

Permalink
Consider absolute windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
zoglo committed Oct 23, 2024
1 parent d91446a commit c2f2872
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/seal/src/Adapter/AdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ public function parseDsn(string $dsn): array
if (\str_contains($dsn, ':///')) {
// make DSN like loupe:///full/path/project/var/indexes parseable
$dsn = \str_replace(':///', '://' . $adapterName . '/', $dsn);
} elseif (\DIRECTORY_SEPARATOR === '\\') {
// might be Windows and contain an absolute path like loupe://C:\path\project\var\indexes which will fail when parse_url is used
$dsnParts = \explode('://', $dsn);

return [
'scheme' => $dsnParts[0] ?? '',
'host' => '',
'path' => $dsnParts[1] ?? '',
'query' => [],
];
} else {
$dsn = $dsn . '@' . $adapterName . $query;
}
Expand Down

0 comments on commit c2f2872

Please sign in to comment.