Skip to content

fix(sqlite): read file URL parameters and name exports after the database file - #4390

Merged
datlechin merged 7 commits into
mainfrom
fix/sqlite-file-names
Nov 21, 2026
Merged

datlechin merged 7 commits into
mainfrom
fix/sqlite-file-names

Conversation

@datlechin

@datlechin datlechin commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • sqlite://, duckdb:// and beancount:// URLs: the path ends at the first ? and is percent-decoded. name, table, view, statusColor, env, safeModeLevel and the filter parameters apply as they do on server URLs.
  • A file URL whose path decodes to a NUL, or to a file: name SQLite would read as a URI, is refused. Either would open a different file than the alert shows.
  • A file URL with no name is titled with the file name, shop, instead of SQLite //path/to/shop.sqlite. Import from URL and Open Project Folder suggest the same name.
  • A file link opens the saved connection to that file, matched by path instead of the host and port the form stored. A row that reads its file over SSH, or a DuckDB row in Remote mode, never matches.
  • A DuckDB link also stores its path in the DuckDB file field, so opening the same file from Finder finds the open session.
  • A ?table= file link connects first, then opens the table in the database the driver opened on, recorded as ConnectionSession.openedDatabase. A DuckDB session browsing an attached catalog no longer gets the table of that catalog.
  • Copy Connection String: a file URL percent-encodes its path and carries name, statusColor and env. Beancount gets the three-slash file form instead of four.
  • Export Tables suggests shop.csv for /path/to/shop.sqlite when no single table is selected, in every format. The export tree titles that database row shop.sqlite.
  • The multi-host MongoDB parser and the file parser share one query splitter, which keeps a bare = as an empty parameter.

Test plan

Fail on main, pass here:

  • ConnectionURLParserTests: file URL query and name, decoded path, NUL and file: refusal, suggested name, shared parameters.
  • ConnectionURLFormatterTests: encoded path round trip, name and color on SQLite and Beancount URLs.
  • DatabaseURLConnectionMatchTests: file link matches by path, DuckDB file field, remote-file rows skipped.
  • TransientConnectionFactoryTests: link title and DuckDB file field.
  • TabRouterTargetingTests: a file link's table database.
  • ExportPreselectionTests, ExportTreeBuilderTests: export file name and tree row title.

Updated on purpose: ExportUITests.testExportingEveryTableAsStructureOnly found the database row by a label starting with /, the full path this PR replaces with the file name. It now looks the row up by the fixture's file name.

Verified on CI: local builds were paused for a benchmark run on this Mac.

Fixes #4388
Fixes #4389

@datlechin
datlechin enabled auto-merge (squash) November 21, 2026 08:07
@datlechin
datlechin merged commit 20222e5 into main Nov 21, 2026
11 checks passed
@datlechin
datlechin deleted the fix/sqlite-file-names branch November 22, 2026 00:01
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

Successfully merging this pull request may close these issues.

sqlite:// URL reads its query parameters as part of the file path SQLite export suggests the database file's full path as the file name

1 participant