-
Notifications
You must be signed in to change notification settings - Fork 145
fix: windows absolute path #140
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -56,8 +56,12 @@ class SQLiteDSNParser implements DSNParser { | |||||||||
| else { | ||||||||||
| // Get the path part, handling both relative and absolute paths | ||||||||||
| if (url.pathname.startsWith("//")) { | ||||||||||
| // Absolute path: sqlite:///path/to/db.sqlite | ||||||||||
| // Unix absolute path: sqlite:///path/to/db.sqlite | ||||||||||
| dbPath = url.pathname.substring(2); // Remove leading // | ||||||||||
| } else if (url.pathname.match(/^\/[A-Za-z]:\//)) { | ||||||||||
| // Windows absolute path: sqlite:///C:/path/to/db.sqlite | ||||||||||
|
Comment on lines
+61
to
+62
|
||||||||||
| } else if (url.pathname.match(/^\/[A-Za-z]:\//)) { | |
| // Windows absolute path: sqlite:///C:/path/to/db.sqlite | |
| } else if (url.pathname.match(/^\/[A-Za-z]:[\/\\]/)) { | |
| // Windows absolute path: sqlite:///C:/path/to/db.sqlite or sqlite:///C:\path\to\db.sqlite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition order creates a logic error: Windows UNC paths like
//server/sharewould incorrectly match the Unix absolute path check first. The Windows drive letter check should come before the//check, or add an additional condition to exclude Windows drive patterns from the Unix path logic (e.g.,url.pathname.startsWith('//') && !url.pathname.match(/^\/\/[A-Za-z]:\//)).