Skip to content

fix(connections): URL import edge cases: raw special characters, Windows SQLite, IPv6 (#1315) - #1329

Merged
ZhuchkaTriplesix merged 3 commits into
devfrom
fix/1315-url-import-edge-cases
Oct 10, 2026
Merged

ZhuchkaTriplesix merged 3 commits into
devfrom
fix/1315-url-import-edge-cases

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #1315

Problem (connection_url_parser.dart)

  1. postgres://user:p@ss@host/db, ...:p#ss@... and mysql://root:pa/ss@host/db make Uri.tryParse return null: the user got only Invalid URL/URI format., for the commonest cause (a raw password copied from a cloud console) and with no word about encoding.
  2. sqlite:///C:/data/app.db gave the path /C:/data/app.db, which does not exist on Windows.
  3. uri.host is ::1 without brackets, so the default name read PostgreSQL: ::1:5432 and a Mongo URI built from the host was invalid.

Fix

  • For a string Uri rejects, the user info (up to the last @ before the query) is percent-encoded, keeping what is already encoded; the row stores that valid string. If it still cannot be read and contains an @, the message says to percent-encode special characters (@ is %40, ...).
  • A /X:/ or /X:\ path loses the URI's slash.
  • The default name brackets an IPv6 host; MongoConnection.buildConnectionUri brackets it in the URI it writes.

Tests: four raw-password URLs (host, password, database, valid stored string), an encoded password stays encoded once, the encoding hint (and the plain message without an @), the Windows path and an unchanged POSIX path, the IPv6 name.

…ows SQLite, IPv6 (#1315)

- A password with @, /, # or ? written as is no longer ends in
  'Invalid URL/URI format.': the user info up to the last @ is
  percent-encoded and the stored string is the valid one. When it still
  cannot be read, the message names percent-encoding.
- sqlite:///C:/data/app.db is C:/data/app.db, without the URI's slash.
- An IPv6 host is bracketed in the default name and in the Mongo URI the
  connection builds.
@github-actions github-actions Bot added bug Something isn't working parser Theme parser epic label: parser connections Database connections, URI parsing, pools P3 Low priority / Polish & Enhancements labels Oct 10, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit a84fb0c into dev Oct 10, 2026
15 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the fix/1315-url-import-edge-cases branch October 11, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working connections Database connections, URI parsing, pools P3 Low priority / Polish & Enhancements parser Theme parser epic label: parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant