Repository navigation
Conversation
`config.path` is documented as a filesystem path, but `start()` parsed it as
a URL. On Windows `new URL('C:\\data\\koishi.db', base)` reads `C:` as a URL
scheme and `fileURLToPath` throws `ERR_INVALID_URL_SCHEME`.
Convert a drive-letter path with `pathToFileURL`, the same way `include` and
`hmr` now do in `cordis`. Relative, POSIX-absolute, UNC and `file:` URL forms
are unchanged.
Regression: 6bb2963 replaced `resolve(this.ctx.baseDir, ...)` with the URL form
and rewrote the sqlite test to pass a `file:` URL in the same commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SQLiteDriver.start()atpackages/sqlite/src/index.ts:166parsesconfig.pathas a URL:pathis documented as a filesystem path (z.string().role('path'), localepath: Database path.), but on Windowsnew URL('C:\\data\\koishi.db', base)readsC:as a URL scheme, andfileURLToPaththrowsTypeError: The URL must be of scheme file. An absolute path — accepted byresolve()before the migration — therefore cannot start the driver on Windows.This is a regression from the v4 migration.
origin/v3resolved it as a filesystem path:Commit
6bb2963("test: fix tests") replaced that line with the URL form and, in the same commit, changed the sqlite test fromjoin(__dirname, 'test.db')tonew URL('test.db', import.meta.url).href. The test was adapted to the new code, so the break was not caught.The same idiom was fixed twice recently in
cordiverse/cordisby the same maintainer:packages/include/src/index.ts(mergedcordiverse/cordis#200) andpackages/hmr/src/index.ts(mergedcordiverse/cordis#208), both with the comment "new URL()would read itsC:as a URL scheme, whichfileURLToPathrejects". This patch applies the same conversion (viapathToFileURL) to the sqlite driver. Relative paths,file:URLs, POSIX-absolute paths and UNC paths still go throughnew URL()unchanged.The test case is in the existing
packages/sqlite/tests/index.spec.ts, so the package keeps running as a single vitest worker. It asserts the resolvedpath, is gated to Windows, and a control case covers relative paths. On an unmodifiedmainthe new case fails with theTypeErrorabove; with the patch the package suite is 269 passed (267 + 2). Locally the shared performancebeforeAllneeds more than vitest's default 10 s hook timeout, onmainas well as with this patch.Relative paths containing
#or?are also truncated bynew URL(); that is a separate issue and is not changed here.